1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-6339 deprecate log_slow_admin_statements

log_slow_filter=admin as been available for a long time.

Uses can migrate from log_slow_statements_statements=OFF by removing
'admin' from the default log_slow_filter variable setting.
This commit is contained in:
Daniel Black
2022-12-05 09:03:06 +11:00
parent 61161cdaf9
commit 26ef4875e6
6 changed files with 37 additions and 6 deletions

View File

@ -6,6 +6,8 @@ SET @@GLOBAL.log_output='TABLE';
FLUSH SLOW LOGS; FLUSH SLOW LOGS;
SET @@GLOBAL.slow_query_log=ON; SET @@GLOBAL.slow_query_log=ON;
SET @@GLOBAL.log_slow_admin_statements=ON; SET @@GLOBAL.log_slow_admin_statements=ON;
Warnings:
Warning 1287 '@@log_slow_admin_statements' is deprecated and will be removed in a future release. Please use '@@log_slow_filter' instead
SET @saved_dbug = @@debug_dbug; SET @saved_dbug = @@debug_dbug;
SET SESSION debug_dbug="+d,simulate_slow_query"; SET SESSION debug_dbug="+d,simulate_slow_query";
CREATE PROCEDURE show_slow_log() CREATE PROCEDURE show_slow_log()
@ -19,6 +21,8 @@ $$
# Expect all admin statements in the slow log (ON,DEFAULT) # Expect all admin statements in the slow log (ON,DEFAULT)
# #
SET @@SESSION.log_slow_admin_statements=ON; SET @@SESSION.log_slow_admin_statements=ON;
Warnings:
Warning 1287 '@@log_slow_admin_statements' is deprecated and will be removed in a future release. Please use '@@log_slow_filter' instead
SET log_slow_filter=DEFAULT; SET log_slow_filter=DEFAULT;
TRUNCATE TABLE mysql.slow_log; TRUNCATE TABLE mysql.slow_log;
CREATE TABLE t1 (a INT); CREATE TABLE t1 (a INT);
@ -66,6 +70,8 @@ sql_text
# Expect all admin statements in the slow log (ON,admin) # Expect all admin statements in the slow log (ON,admin)
# #
SET @@SESSION.log_slow_admin_statements=ON; SET @@SESSION.log_slow_admin_statements=ON;
Warnings:
Warning 1287 '@@log_slow_admin_statements' is deprecated and will be removed in a future release. Please use '@@log_slow_filter' instead
SET log_slow_filter=admin; SET log_slow_filter=admin;
TRUNCATE TABLE mysql.slow_log; TRUNCATE TABLE mysql.slow_log;
CREATE TABLE t1 (a INT); CREATE TABLE t1 (a INT);
@ -100,6 +106,8 @@ sql_text
# Expect none of admin DDL statements in the slow log (ON,filesort) # Expect none of admin DDL statements in the slow log (ON,filesort)
# #
SET @@SESSION.log_slow_admin_statements=ON; SET @@SESSION.log_slow_admin_statements=ON;
Warnings:
Warning 1287 '@@log_slow_admin_statements' is deprecated and will be removed in a future release. Please use '@@log_slow_filter' instead
SET log_slow_filter=filesort; SET log_slow_filter=filesort;
TRUNCATE TABLE mysql.slow_log; TRUNCATE TABLE mysql.slow_log;
CREATE TABLE t1 (a INT); CREATE TABLE t1 (a INT);
@ -127,6 +135,8 @@ sql_text
# Expect none of admin statements in the slow log (OFF,DEFAULT) # Expect none of admin statements in the slow log (OFF,DEFAULT)
# #
SET @@SESSION.log_slow_admin_statements=OFF; SET @@SESSION.log_slow_admin_statements=OFF;
Warnings:
Warning 1287 '@@log_slow_admin_statements' is deprecated and will be removed in a future release. Please use '@@log_slow_filter' instead
SET log_slow_filter=DEFAULT; SET log_slow_filter=DEFAULT;
TRUNCATE TABLE mysql.slow_log; TRUNCATE TABLE mysql.slow_log;
CREATE TABLE t1 (a INT); CREATE TABLE t1 (a INT);
@ -171,7 +181,11 @@ sql_text
# prevent enabling globally suppressed logging by setting the session variable to ON. # prevent enabling globally suppressed logging by setting the session variable to ON.
# #
SET @@GLOBAL.log_slow_admin_statements=OFF; SET @@GLOBAL.log_slow_admin_statements=OFF;
Warnings:
Warning 1287 '@@log_slow_admin_statements' is deprecated and will be removed in a future release. Please use '@@log_slow_filter' instead
SET @@SESSION.log_slow_admin_statements=ON; SET @@SESSION.log_slow_admin_statements=ON;
Warnings:
Warning 1287 '@@log_slow_admin_statements' is deprecated and will be removed in a future release. Please use '@@log_slow_filter' instead
SET log_slow_filter=DEFAULT; SET log_slow_filter=DEFAULT;
TRUNCATE TABLE mysql.slow_log; TRUNCATE TABLE mysql.slow_log;
CREATE TABLE t1 (a INT); CREATE TABLE t1 (a INT);
@ -223,4 +237,6 @@ TRUNCATE mysql.slow_log;
SET @@global.slow_query_log= @org_slow_query_log; SET @@global.slow_query_log= @org_slow_query_log;
SET @@global.log_output= @org_log_output; SET @@global.log_output= @org_log_output;
SET @@global.log_slow_admin_statements= @org_log_slow_admin_statements; SET @@global.log_slow_admin_statements= @org_log_slow_admin_statements;
Warnings:
Warning 1287 '@@log_slow_admin_statements' is deprecated and will be removed in a future release. Please use '@@log_slow_filter' instead
DROP PROCEDURE show_slow_log; DROP PROCEDURE show_slow_log;

View File

@ -508,8 +508,8 @@ The following specify which files/extra groups are read (specified before remain
--log-slow-admin-statements --log-slow-admin-statements
Log slow OPTIMIZE, ANALYZE, ALTER and other Log slow OPTIMIZE, ANALYZE, ALTER and other
administrative statements to the slow log if it is open. administrative statements to the slow log if it is open.
Resets or sets the option 'admin' in Resets or sets the option 'admin' in log_slow_filter.
log_slow_disabled_statements Deprecated, use log_slow_filter without 'admin'.
(Defaults to on; use --skip-log-slow-admin-statements to disable.) (Defaults to on; use --skip-log-slow-admin-statements to disable.)
--log-slow-disabled-statements=name --log-slow-disabled-statements=name
Don't log certain types of statements to slow log. Any Don't log certain types of statements to slow log. Any

View File

@ -11,6 +11,8 @@ SET GLOBAL log_output = 'file,table';
SET GLOBAL slow_query_log = on; SET GLOBAL slow_query_log = on;
SET SESSION long_query_time = 0; SET SESSION long_query_time = 0;
SET SESSION log_slow_admin_statements = on; SET SESSION log_slow_admin_statements = on;
Warnings:
Warning 1287 '@@log_slow_admin_statements' is deprecated and will be removed in a future release. Please use '@@log_slow_filter' instead
ALTER TABLE log_slow_admin_statements ADD COLUMN k INT DEFAULT 17; ALTER TABLE log_slow_admin_statements ADD COLUMN k INT DEFAULT 17;
CREATE PROCEDURE add_rows() CREATE PROCEDURE add_rows()
BEGIN BEGIN
@ -42,22 +44,32 @@ SET @@global.log_output= @old_log_output;
SET @@global.slow_query_log= @old_slow_query_log; SET @@global.slow_query_log= @old_slow_query_log;
SET @@session.long_query_time= @old_long_query_time; SET @@session.long_query_time= @old_long_query_time;
SET @@global.log_slow_admin_statements= @old_log_slow_admin_statements; SET @@global.log_slow_admin_statements= @old_log_slow_admin_statements;
Warnings:
Warning 1287 '@@log_slow_admin_statements' is deprecated and will be removed in a future release. Please use '@@log_slow_filter' instead
DROP PROCEDURE add_rows; DROP PROCEDURE add_rows;
TRUNCATE TABLE mysql.slow_log; TRUNCATE TABLE mysql.slow_log;
SET @save_log_slow_disabled_statements= @@global.log_slow_disabled_statements; SET @save_log_slow_disabled_statements= @@global.log_slow_disabled_statements;
SET @@SESSION.log_slow_admin_statements= TRUE; SET @@SESSION.log_slow_admin_statements= TRUE;
Warnings:
Warning 1287 '@@log_slow_admin_statements' is deprecated and will be removed in a future release. Please use '@@log_slow_filter' instead
select @@SESSION.log_slow_disabled_statements; select @@SESSION.log_slow_disabled_statements;
@@SESSION.log_slow_disabled_statements @@SESSION.log_slow_disabled_statements
sp sp
SET @@SESSION.log_slow_admin_statements= FALSE; SET @@SESSION.log_slow_admin_statements= FALSE;
Warnings:
Warning 1287 '@@log_slow_admin_statements' is deprecated and will be removed in a future release. Please use '@@log_slow_filter' instead
select @@SESSION.log_slow_disabled_statements; select @@SESSION.log_slow_disabled_statements;
@@SESSION.log_slow_disabled_statements @@SESSION.log_slow_disabled_statements
admin,sp admin,sp
SET @@GLOBAL.log_slow_admin_statements= TRUE; SET @@GLOBAL.log_slow_admin_statements= TRUE;
Warnings:
Warning 1287 '@@log_slow_admin_statements' is deprecated and will be removed in a future release. Please use '@@log_slow_filter' instead
select @@GLOBAL.log_slow_disabled_statements; select @@GLOBAL.log_slow_disabled_statements;
@@GLOBAL.log_slow_disabled_statements @@GLOBAL.log_slow_disabled_statements
sp sp
SET @@GLOBAL.log_slow_admin_statements= FALSE; SET @@GLOBAL.log_slow_admin_statements= FALSE;
Warnings:
Warning 1287 '@@log_slow_admin_statements' is deprecated and will be removed in a future release. Please use '@@log_slow_filter' instead
select @@GLOBAL.log_slow_disabled_statements; select @@GLOBAL.log_slow_disabled_statements;
@@GLOBAL.log_slow_disabled_statements @@GLOBAL.log_slow_disabled_statements
admin,sp admin,sp

View File

@ -1665,7 +1665,7 @@ COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME LOG_SLOW_ADMIN_STATEMENTS VARIABLE_NAME LOG_SLOW_ADMIN_STATEMENTS
VARIABLE_SCOPE SESSION VARIABLE_SCOPE SESSION
VARIABLE_TYPE BOOLEAN VARIABLE_TYPE BOOLEAN
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_disabled_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'.
NUMERIC_MIN_VALUE NULL NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL NUMERIC_BLOCK_SIZE NULL

View File

@ -1815,7 +1815,7 @@ COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME LOG_SLOW_ADMIN_STATEMENTS VARIABLE_NAME LOG_SLOW_ADMIN_STATEMENTS
VARIABLE_SCOPE SESSION VARIABLE_SCOPE SESSION
VARIABLE_TYPE BOOLEAN VARIABLE_TYPE BOOLEAN
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_disabled_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'.
NUMERIC_MIN_VALUE NULL NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL NUMERIC_BLOCK_SIZE NULL

View File

@ -1511,9 +1511,12 @@ static Sys_var_bit Sys_log_slow_admin_statements(
"log_slow_admin_statements", "log_slow_admin_statements",
"Log slow OPTIMIZE, ANALYZE, ALTER and other administrative statements " "Log slow OPTIMIZE, ANALYZE, ALTER and other administrative statements "
"to the slow log if it is open. Resets or sets the option 'admin' in " "to the slow log if it is open. Resets or sets the option 'admin' in "
"log_slow_disabled_statements", "log_slow_filter. "
"Deprecated, use log_slow_filter without 'admin'.",
SESSION_VAR(log_slow_disabled_statements), SESSION_VAR(log_slow_disabled_statements),
CMD_LINE(OPT_ARG), REVERSE(LOG_SLOW_DISABLE_ADMIN), DEFAULT(TRUE)); CMD_LINE(OPT_ARG), REVERSE(LOG_SLOW_DISABLE_ADMIN), DEFAULT(TRUE),
0, NOT_IN_BINLOG, ON_CHECK(0), ON_UPDATE(0),
DEPRECATED("'@@log_slow_filter'"));
static Sys_var_bit Sys_log_slow_slave_statements( static Sys_var_bit Sys_log_slow_slave_statements(
"log_slow_slave_statements", "log_slow_slave_statements",