Details
-
Task
-
Status: Open (View Workflow)
-
Minor
-
Resolution: Unresolved
-
None
-
None
Description
We have too many slow-log-filtering-related variables with partially intersecting scopes, confusing purpose, and unclear or wrong documentation.
1)
VARIABLE_NAME: LOG_SLOW_FILTER
|
VARIABLE_COMMENT: Log only certain types of queries to the slow log. If variable empty all kind of queries are logged. All types are bound by slow_query_time, except 'not_using_index' which is always logged if enabled
|
ENUM_VALUE_LIST: admin,filesort,filesort_on_disk,filesort_priority_queue,full_join,full_scan,not_using_index,query_cache,query_cache_miss,tmp_table,tmp_table_on_disk
|
2)
VARIABLE_NAME: LOG_SLOW_DISABLED_STATEMENTS
|
VARIABLE_COMMENT: Don't log certain types of statements to slow log
|
ENUM_VALUE_LIST: admin,call,slave,sp
|
3)
VARIABLE_NAME: LOG_SLOW_SLAVE_STATEMENTS
|
VARIABLE_COMMENT: Log slow statements executed by slave thread to the slow log if it is open. Resets or sets the option 'slave' in log_slow_disabled_statements
|
ENUM_VALUE_LIST: OFF,ON
|
4)
VARIABLE_NAME: LOG_SLOW_ADMIN_STATEMENTS
|
VARIABLE_COMMENT: Log slow OPTIMIZE, ANALYZE, ALTER and other administrative statements to the slow log if it is open. Resets or sets the option 'admin' in log_slow_filter. Deprecated, use log_slow_filter without 'admin'
|
ENUM_VALUE_LIST: OFF,ON
|
Number #4, LOG_SLOW_ADMIN_STATEMENTS, is deprecated, and rightly so. It even reasonably suggests to use LOG_SLOW_FILTER instead; but in fact, if it's set/unset, it changes LOG_SLOW_DISABLED_STATEMENTS instead of LOG_SLOW_FILTER.
Number #3, LOG_SLOW_SLAVE_STATEMENTS, also changes LOG_SLOW_DISABLED_STATEMENTS when it's set/unset, but it is not deprecated, as it should be.
The reason for existence of both #1 and #2 is unclear, and MDEV-8305 where LOG_SLOW_DISABLED_STATEMENTS was introduced doesn't really help to understand it. It is described as "Don't log certain types of statements", while LOG_SLOW_FILTER is described as "Log only certain types of queries". If the descriptions are accurate, then one of them is redundant, as they negate each other. It would make sense to have both if one was about really about types of queries, while another one was about the source of queries, e.g. log_slow_filter=filesort log_slow_disabled_statements=sp would read "log filesort type, but not from stored procedures". However, if that's the idea, there is still admin value which on some reason is present in both; and the call value in filesort log_slow_disabled_statements is also confusing, it should probably belong to log_slow_filter in this case.
Finally, the KB page about slow logging is outdated in this regard, it still suggests using log_slow_admin_statements, and there are probably many more things which need to be changed.