Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mariadb-plugin-variable-owner

mariabd-plugin-variable-owner

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   |
+-----------------+--------------------+-----------------------+--------------------------------------------------------------+---------------+

Build

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_owner

Install

Load it like any other plugin, either at startup:

[mariadb]
plugin_load_add=variable_owner

or at runtime:

INSTALL SONAME 'variable_owner';

Usage

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).

Limitations

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.

Test

cd /path/to/build/mysql-test
./mtr --suite=variable_owner

About

MariaDB information schema plugin that reports, for every system variable known to the server, who registered it

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages