variable_owner is a MariaDB information schema plugin that reports, for
every system variable known to the server, who registered it: server for
variables declared by the server core, or the name of the plugin that
registered it (a storage engine, an audit plugin, an authentication plugin,
...).
It adds one table, INFORMATION_SCHEMA.VARIABLES_OWNER:
SELECT plugin_name, plugin_type, plugin_library,
plugin_description, plugin_author
FROM information_schema.PLUGINS
WHERE plugin_name = 'VARIABLES_OWNER';Result:
+-----------------+--------------------+-----------------------+--------------------------------------------------------------+---------------+
| plugin_name | plugin_type | plugin_library | plugin_description | plugin_author |
+-----------------+--------------------+-----------------------+--------------------------------------------------------------+---------------+
| VARIABLES_OWNER | INFORMATION SCHEMA | variable_owner.so | Lists every system variable and the plugin (or "server") ... | MariaDB plc |
+-----------------+--------------------+-----------------------+--------------------------------------------------------------+---------------+
Configure MariaDB with the plugin enabled (it is picked up automatically from
plugin/variable_owner, no top-level CMakeLists.txt change is needed):
cmake -S /path/to/MariaDB-server \
-B /path/to/build \
-DPLUGIN_VARIABLE_OWNER=DYNAMIC
cmake --build /path/to/build --target variable_ownerLoad it like any other plugin, either at startup:
[mariadb]
plugin_load_add=variable_owneror at runtime:
INSTALL SONAME 'variable_owner';SELECT * FROM information_schema.variables_owner
WHERE variable_name IN ('max_connections', 'innodb_buffer_pool_size');+-------------------------+----------------+
| VARIABLE_NAME | VARIABLE_OWNER |
+-------------------------+----------------+
| max_connections | server |
| innodb_buffer_pool_size | InnoDB |
+-------------------------+----------------+
A breakdown of how many variables each plugin owns:
SELECT variable_owner, COUNT(*)
FROM information_schema.variables_owner
GROUP BY variable_owner
ORDER BY 2 DESC;information_schema.variables_owner always has exactly as many rows as
information_schema.system_variables, since every system variable is
reported with an owner (falling back to server when no plugin claims it).
Ownership is resolved from the set of currently loaded plugins. Uninstalling
a plugin removes its variables from system_variables (and therefore from
this table) as usual; the table does not retain history of variables owned
by plugins that were previously unloaded.
cd /path/to/build/mysql-test
./mtr --suite=variable_owner