WL#11828: Convert syslog/Eventlog-related system-variables to component variables
Affects: Server-8.0 — Status: Complete — Priority: Medium
When the new structured / pluggable error logging was developed, logging to unix's syslog / Window's EventLog was moved to a loadable component. As the component framework did not at that time support component variables (pluggable system variables), the system variables controlling the operation of syslogging/Eventlogging have remained in the server, alongside some of the logging functionality. Now that component variables are available, the syslog/Eventlog variables should be updated to use them to achieve the following: - less surprising behavior: currently, the component can be unloaded, but the system variables remain visible to the user. Assigning values to these variables is not possible in this state: the code deciding on the validity of submitted values has been unloaded and, with no one to approve the new value, we must reject it by default. (It's better to throw a visible error here than to let the user think they succeeded in setting a value that is invalid at worst, and without effect at best.) This also led to SET PERSIST breaking in certain cases, as persisted values can not be restored when the component to approve them is not loaded. - cleaner separation of concerns -- we should endeavour to have most of the code concerned with syslogging/eventlogging in the same place; we should not have half of it in the server and static, and the other half unloadable in a module, if we can avoid it. - stream-lining of the code-base: Component variables were not available when the first logging components were written. In their stead, code to propagate changes in system variables to listeners in log-service components was built into the new logging engine. This code can be removed once its last user, the syslog/eventlog component, no longer needs it.
1 Functional Requirements 1.1 Pluggable system variables The variables controlling syslogging/Event-logging should move from the server proper into the sys/eventlog component, and be namespaced accordingly. This will also fix the problem of "log_sys_* global variables do not work with set global/persist". 2 Non-functional Requirements 2.1 Update log-service API The structured logging engine features functionality intended to let loaded components have system-variables that somewhat duplicates functionality now added to the component framework. FR-1.1.1 will remove the last user of error-logging's variable handling, as variable handling is changed over to the component framework's new API for this. This suggests the following steps to remove the now dead code and clean up the API: 2.1.1 Remove sysvar check/update forwarding from logging engine 2.1.2 Remove calls for sysvar check/update from log-service API 2.1.3 Remove handlers for sysvar check/update from log-services 2.1.4 Add function returning log-component characteristics to API As part of updating the API, the a function returning the information about the following characteristics shall be added to provide the foundation for requested diagnostics and functionality: a) Is it a source, a filter, or a sink? Use case: this will let us throw warnings when trying to set suspicious or unsupported pipeline layouts (e.g. having a filter as the last element in the pipeline). b) Is it read-only? I.e., does it promise not to change the log-event? Use case: lets us determine whether it's safe to e.g. run several writers in parallel. (Writers guaranteeing this would also implicitly promise not to use the log- event's default iter.) c) Is it a singleton, or can it be opened multiple times? Use case: complaining when a singleton, such as the syslog writer, is used more than once in the logging pipeline. 2.2 Move syslog/eventlog-related code from server into component where possible This was the original design, which was deferred. Amend by moving syslog/eventlog-related code from server into component where possible.
I-1 SQL syntax NO CHANGE I-2 Instrumentation NO CHANGE I-3 Error and Warnings NO CHANGE I-4 Install/Upgrade Some system variable names are changed. Configurations (my.cnf) that use the old variable names must be updated. Due to implementation details of the interim variable handler, the settings could not be PERSISTed using the old names, so an upgrade of persisted values should not be necessary. I-5 Commercial Plugins NO CHANGE I-6 Replication NO CHANGE I-7 Protocols NO CHANGE I-8 Security NO CHANGE I-9 Log files NO CHANGE I-10 MySQL clients NO CHANGE I-11 Auth plugins NO CHANGE I-12 Globalization NO CHANGE I-13 Configuration Syslog/Eventlog-related system variables are renamed: @@global.log_syslog_X becomes @@global.syseventlog.X. The on/off toggle @@global.log_syslog is removed entirely, as on/off is now expressed by the component's inclusion in, or exclusion from, the logging pipeline, @@global.log_error_services. See below, Low-Level Design Specification, for a complete list. I-14 File formats NO CHANGE I-15 Plugins/APIs Error-logging component API: - new function: log-components' characteristics (read-only, multi-open, source/sink/filter) can be queried - removed functions: sys-var check/update functions are removed as their functionality is now covered by per-component system-variables. The syslog/Eventlog-writer was the last user of this interface. I-16 Other programs NO CHANGE I-17 Storage engines NO CHANGE
1 System variables 1.1 Move sys/Event-log variables into component namespace These variables should move from the server-proper into the sys/eventlog component, and be namespaced accordingly. All "@@global.log_syslog_X" shall be renamed to ""@@global.syseventlog.X"; the on/off toggle log_syslog shall be removed entirely (as it is replaced by adding the component to or removing it from @@global.log_error_services): @@global.log_syslog_tag -> @@global.syseventlog.tag @@global.log_syslog_facility -> @@global.syseventlog.facility @@global.log_syslog_include_pid -> @@global.syseventlog.include_pid @@global.log_syslog -> removed 1.2 Remove --log-syslog=0 argument from mysql-test-run As this system variable will be removed in 22.214.171.124, mtr should not set it. 2 log-service API 2.1 remove interim log-service variable-handling code 2.1.1 Remove LogVar class from sql/log.h 2.1.2 Remove LogVar class and log_broadcast_sys_var_set() from components/mysql_server/log_builtins.cc 2.1.3 Remove listeners/stubs from log-services 2.2 Add support for a function that may return the following log-component characteristics log_service_imp::characteristics: LOG_SERVICE_READ_ONLY = 1, // service promises not to modify event LOG_SERVICE_SINGLETON = 2, // only one instance may be opened LOG_SERVICE_SOURCE = 32, // service is a log-source (reserved) LOG_SERVICE_FILTER = 64, // service is a log-filter LOG_SERVICE_SINK = 128 // service is a log-sink
Copyright (c) 2000, 2019, Oracle Corporation and/or its affiliates. All rights reserved.