Navicat Blog

April 24, 2018 by Robert Gravelle

One of the numerous significant changes to MySQL Server for version 8 includes a new component-based infrastructure. That will make the architecture more modular while allowing users to extend server capabilities through the addition of individual components.

Each component provides services that are available to the server as well as to other components. In fact, the server itself is now considered to be a component, equal to other components. Components interact with each other only through the services they provide.

Enabling a Component

Component loading and unloading are achieved via the INSTALL COMPONENT and UNINSTALL COMPONENT SQL statements. For example:

INSTALL COMPONENT 'file://component_validate_password';
UNINSTALL COMPONENT 'file://component_validate_password';

A loader service handles component loading and unloading, and also lists loaded components in the mysql.component system table.

INSTALL COMPONENT loads components into the server and activates them immediately. The loader service also registers loaded components in the mysql.component system table. For subsequent server restarts, any components listed in mysql.component are loaded by the loader service during startup.

UNINSTALL COMPONENT deactivates components and unloads them from the server. The loader service also unregisters the components from the mysql.component system table so that they are no longer loaded during startup for subsequent server restarts.

To see which components are installed, use the statement:

SELECT * FROM mysql.component;

Error Log Filtering and Routing

Thanks to the new component architecture, log events can be filtered, and their output can be sent to multiple destinations in a variety formats, including JSON. Log events may even be routed to third-party products like the Navicat Monitor for additional processing and analysis.

Error log configuration is stored in the global log_error_services and log_error_verbosity variables, which are both stored in the global_variables table. Error log variables are prefixed with “log_error_”, so we can fetch both as follows:

mysql>select * from global_variables where VARIABLE_NAME like 'log_error_%';
| VARIABLE_NAME       | VARIABLE_VALUE                         |
| log_error_services  | log_filter_internal; log_sink_internal |
| log_error_verbosity | 2                                      |

There are four available log components. These are stored in the lib/plugins directory, and have an extension of “.so”:





Components can be subdivided into two types: filters and sinks.

  • Filter components implement filtering of error log events. If no filter component is enabled, no filtering occurs. Otherwise, any enabled filter component affects log events only for components listed later in the log_error_services variable.

  • Error log sink components are writers that implement error log output. If no sink component is enabled, no log output occurs. Some sink component descriptions refer to the default error log destination. This is the console or a file and is indicated by the log_error system variable.

To load a component, you need to specify its URN. This is made up of:

“file://” + [the filename without the .so extension]

For example, to load the writer to json component, you would enable it like this:

mysql> INSTALL COMPONENT 'file://component_log_sink_json';

mysql> SET GLOBAL log_error_services = 'log_filter_internal; log_sink_internal; 

mysql> select * from global_variables where VARIABLE_NAME like 'log_error_%';

| VARIABLE_NAME       | VARIABLE_VALUE                                        |
| log_error_services  | log_filter_internal; log_sink_internal; log_sink_json |
| log_error_verbosity | 2                                                     |

We’ll explore the error logging in MySQL 8 in greater detail in future blogs!

Navicat Blogs
Feed Entries
Blog Archives