WL#11393: Implement an interface to suppress error logs of type warning or note.

Affects: Server-8.0   —   Status: Complete   —   Priority: Medium

The MySQL server shall accept a new optional list at start-up or at runtime.
Messages for error-codes on this list are not included in the error-log when 
thrown with a severity of WARNING or INFORMATION, but will be included when 
thrown with a severity of ERROR or SYSTEM.
This functionality will be built-in (no  need to install or load a component or 
plugin) and available by default.
Func-Req 1 - global configuration variable

Func-Req 1.1
A new system variable, @@global.log_error_suppression_list, shall be added to 
the server.

Func-Req 1.2
The variable is of string-type and may be set to an empty string, or to a comma-
separated list of error-codes.

Func-Req 1.3
A comma is valid only between two error-codes, not at the start or end of the 
list or immediately following another comma.

Func-Req 1.4
Error-codes may be expressed in the forms understood and output by the perror 
tool ("MY-12345", "85555", etc.). Only error-codes registered in the error-log 
range (index 10,000+) and in the "global errors" range (shared between MySQL 
server and client applications, range [1,1000[ shall be accepted.

Func-Req 1.5
By default, the error logging pipeline @@global.log_error_services is configured 
to use the basic filter, log_filter_internal. If (and only if) 
log_filter_internal is enabled in this manner, the suppression list will be 
applied. This gives log_error_suppression_list the same behavior as 

Func-Req 1.6
"Application" for the purposes of this WL means that any event that was reported 
with a severity lower than ERROR (that is to say, a severity of WARNING or 
INFORMATION) and whose error-code is in the suppression list will be discarded 
when log_filter_internal is called. Conversely, events with a severity of SYSTEM 
or ERROR will not be discarded by this mechanism even if listed in this 

Func-Req 1.7
In the MySQL server, an event's severity is not registered alongside its 
message; instead, the severity is set at the time the logger is called. The same 
message/error-code may be used with different severities at different locations 
in the source code. (For messages intended for the client, severity may also 
depend on e.g. sql_mode.) Therefore at the time the suppression list is 
assigned, we cannot know which items will be impossible to suppress later 
(ERROR, SYSTEM), and so we can not throw a warning to that effect.
Moreover, we also do not throw such a warning when at run-time, a message thrown 
as ERROR or SYSTEM is logged despite of being in the suppression list, as that 
would defeat the original goal of despamming the error log.

Func-Req 1.8
The default value of the variable shall be "" (an empty list, and therefore, no 
suppressions by default).

Func-Req 2 - command-line option

Func-Req 2.1
The variable shall also be available as a command-line option, --log-error-

Func-Req 2.2
Failure to set a value passed at start-up shall be non-fatal; the default value 
shall be used in such cases, and an error logged.
I-1  Semantics


I-2  Instrumentation


I-3  Error and Warnings


I-4  Install/Upgrade


I-5  Commercial plugins


I-6  Replication

NO CHANGE  (Variable is not binlogged)

I-7  XProtocols


I-8  Protocols


I-9  Security

Future filters may elect to obfuscate parts of plain-text messages however, etc.

I-10  Log Files

[LOG01] Events with a priority of WARNING or INFORMATION whose error-code is in 
the suppression list will not be sent to the error log. (Specifically, the 
default filter "log_filter_internal" that also handles --log-error-verbosity 
must be configured in log_error_services, as it is by default; it marks the 
point in the pipeline where these events are removed. All subsequent log-
services in the pipeline, usually log-sinks/log-writers, will not receive the 
events in question.)

I-11  MySQL clients


I-12  Auth plugins


I-13  Globalization


I-14  Configuration

[CONF02] The filter engine shall use a new system variable for its 
configuration; log_error_suppression_list. This global system variable shall 
reside in the MySQL server's default namespace.
[CONF01] This variable shall also be available on the command-line.

I-15  File formats

NO CHANGE (see log writers for that)

I-16  Plugins/APIs


I-17  Other programs


I-18  Storage engines


I-19  Data types

log_filter_internal implements this functionality, as well as 
that of log_error_verbosity. Both may be used concurrently (e.g. setting 
log_error_verbosity to "discard information-items", then setting 
log_error_suppression_list to a list of warnings to discard additionally, leaving 
a result set of "no info items, only warnings of interest, and all errors and 
system items".

Both system variables serve as simplified user interfaces to the built-in 
filtering engine WL#9342 that is fully exposed by the filtering language 
implemented in WL#9651. They convert their input into rules for said engine; both 
variables inject their rules into the same rule-set.

When updating the suppression list, all previous suppression rules are discarded 
(while leaving any log_error_verbosity rules in place); then rules for each 
error-code in the suppression list are added to the rule-set.