Commit ef08810b authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-7567 Add aliases with prefix log_slow for system variables relating to slow query log

post-merge fixes:
* remove log_slow_queries_not_using_indexes, no need to create variables
  that are deprecated since the moment of creation
* rename log_slow_query_enable->log_slow_query
  no other variable uses *_enable pattern
* MDEV-29626 Assertion `self == &Sys_slow_query_log' failed in fix_log_state
* tests

Closes #2137
parent af4918b4
......@@ -14,8 +14,7 @@ log_slow_admin_statements ON
log_slow_disabled_statements sp
log_slow_filter admin,filesort,filesort_on_disk,filesort_priority_queue,full_join,full_scan,query_cache,query_cache_miss,tmp_table,tmp_table_on_disk
log_slow_min_examined_row_limit 0
log_slow_queries_not_using_indexes OFF
log_slow_query_enable ON
log_slow_query ON
log_slow_query_file_name $PATH/mysqld-slow.log
log_slow_query_time 10.000000
log_slow_rate_limit 1
......
......@@ -8,18 +8,18 @@
--net-buffer-length=#
Buffer length for TCP/IP and socket communication
--net-read-timeout=#
@@ -1275,6 +1276,10 @@
will be written to the binlog. ENFORCE means that
triggers will always be run on the slave, even if there
are triggers on the master. ENFORCE implies LOGGING.
@@ -1328,6 +1329,10 @@
Alias for log_slow_query_file_name. Log slow queries to
given log file. Defaults logging to 'hostname'-slow.log.
Must be enabled to activate other slow log options
+ --slow-start-timeout=#
+ Maximum number of milliseconds that the service control
+ manager should wait before trying to kill the windows
+ service during startup(Default: 15000).
--slave-skip-errors=name
Tells the slave thread to continue replication when a
query event returns an error from the provided list
@@ -1343,6 +1348,7 @@
--socket=name Socket file to use for connection
--sort-buffer-size=#
Each thread that needs to do a sort allocates a buffer of
@@ -1352,6 +1357,7 @@
deleting or updating every row in a table.
--stack-trace Print a symbolic stack trace on failure
(Defaults to on; use --skip-stack-trace to disable.)
......@@ -27,7 +27,7 @@
--standard-compliant-cte
Allow only CTEs compliant to SQL standard
(Defaults to on; use --skip-standard-compliant-cte to disable.)
@@ -1418,6 +1424,11 @@
@@ -1427,6 +1433,11 @@
--thread-pool-max-threads=#
Maximum allowed number of worker threads in the thread
pool
......@@ -39,7 +39,7 @@
--thread-pool-oversubscribe=#
How many additional active worker threads in a group are
allowed.
@@ -1456,8 +1467,8 @@
@@ -1465,8 +1476,8 @@
automatically convert it to an on-disk MyISAM or Aria
table.
-t, --tmpdir=name Path for temporary files. Several paths may be specified,
......@@ -50,7 +50,7 @@
--transaction-alloc-block-size=#
Allocation block size for transactions to be stored in
binary log
@@ -1678,6 +1689,7 @@
@@ -1686,6 +1697,7 @@
myisam-stats-method NULLS_UNEQUAL
myisam-use-mmap FALSE
mysql56-temporal-format TRUE
......@@ -58,7 +58,7 @@
net-buffer-length 16384
net-read-timeout 30
net-retry-count 10
@@ -1832,6 +1844,7 @@
@@ -1842,6 +1854,7 @@
slave-type-conversions
slow-launch-time 2
slow-query-log FALSE
......@@ -66,7 +66,7 @@
sort-buffer-size 2097152
sql-mode STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
sql-safe-updates FALSE
@@ -1858,6 +1871,8 @@
@@ -1868,6 +1881,8 @@
thread-pool-exact-stats FALSE
thread-pool-idle-timeout 60
thread-pool-max-threads 65536
......
......@@ -497,9 +497,8 @@ The following specify which files/extra groups are read (specified before remain
--log-output=name How logs should be written. Any combination of: NONE,
FILE, TABLE
--log-queries-not-using-indexes
Alias for log_slow_queries_not_using_indexes. Log queries
that are executed without benefit of any index to the
slow log if it is open. Same as
Log queries that are executed without benefit of any
index to the slow log if it is open. Same as
log_slow_filter='not_using_index'
--log-short-format Don't log extra information to update and slow-query
logs.
......@@ -527,12 +526,7 @@ The following specify which files/extra groups are read (specified before remain
--log-slow-min-examined-row-limit=#
Don't write queries to slow log that examine fewer rows
than that
--log-slow-queries-not-using-indexes
Log queries that are executed without benefit of any
index to the slow log if it is open. Same as
log_slow_filter='not_using_index'
--log-slow-query-enable
Log slow queries to a table or log file. Defaults logging
--log-slow-query Log slow queries to a table or log file. Defaults logging
to a file 'hostname'-slow.log or a table mysql.slow_log
if --log-output=TABLE is used. Must be enabled to
activate other slow log options.
......@@ -1326,11 +1320,10 @@ The following specify which files/extra groups are read (specified before remain
If creating the thread takes longer than this value (in
seconds), the Slow_launch_threads counter will be
incremented
--slow-query-log Alias for log_slow_query_enable. Log slow queries to a
table or log file. Defaults logging to a file
'hostname'-slow.log or a table mysql.slow_log if
--log-output=TABLE is used. Must be enabled to activate
other slow log options.
--slow-query-log Alias for log_slow_query. Log slow queries to a table or
log file. Defaults logging to a file 'hostname'-slow.log
or a table mysql.slow_log if --log-output=TABLE is used.
Must be enabled to activate other slow log options.
--slow-query-log-file=name
Alias for log_slow_query_file_name. Log slow queries to
given log file. Defaults logging to 'hostname'-slow.log.
......@@ -1641,8 +1634,7 @@ log-slow-admin-statements TRUE
log-slow-disabled-statements sp
log-slow-filter admin,filesort,filesort_on_disk,filesort_priority_queue,full_join,full_scan,query_cache,query_cache_miss,tmp_table,tmp_table_on_disk
log-slow-min-examined-row-limit 0
log-slow-queries-not-using-indexes FALSE
log-slow-query-enable FALSE
log-slow-query FALSE
log-slow-query-time 10
log-slow-rate-limit 1
log-slow-slave-statements TRUE
......
......@@ -1147,6 +1147,16 @@ sql_text
select sleep(0.1)
set statement long_query_time=0.01 for select sleep(0.1)
#---
#should be written
set statement log_slow_query_time=0.01 for select sleep(0.1);
sleep(0.1)
0
select sql_text from mysql.slow_log where sql_text not like 'set @@long_query_time%';
sql_text
select sleep(0.1)
set statement long_query_time=0.01 for select sleep(0.1)
set statement log_slow_query_time=0.01 for select sleep(0.1)
#---
set @@long_query_time=0.01;
#should NOT be written
set statement slow_query_log=0 for select sleep(0.1);
......@@ -1157,6 +1167,7 @@ select sql_text from mysql.slow_log where sql_text not like 'set @@long_query_ti
sql_text
select sleep(0.1)
set statement long_query_time=0.01 for select sleep(0.1)
set statement log_slow_query_time=0.01 for select sleep(0.1)
#---
#should NOT be written
set statement long_query_time=0.01,log_slow_filter='full_scan' for select sleep(0.1);
......@@ -1166,6 +1177,7 @@ select sql_text from mysql.slow_log where sql_text not like 'set @@long_query_ti
sql_text
select sleep(0.1)
set statement long_query_time=0.01 for select sleep(0.1)
set statement log_slow_query_time=0.01 for select sleep(0.1)
#---
#should NOT be written
set statement long_query_time=0.01,log_slow_rate_limit=9999 for select sleep(0.1);
......@@ -1175,6 +1187,7 @@ select sql_text from mysql.slow_log where sql_text not like 'set @@long_query_ti
sql_text
select sleep(0.1)
set statement long_query_time=0.01 for select sleep(0.1)
set statement log_slow_query_time=0.01 for select sleep(0.1)
#---
#should NOT be written
set statement long_query_time=0.01,min_examined_row_limit=50 for select sleep(0.1);
......@@ -1184,6 +1197,17 @@ select sql_text from mysql.slow_log where sql_text not like 'set @@long_query_ti
sql_text
select sleep(0.1)
set statement long_query_time=0.01 for select sleep(0.1)
set statement log_slow_query_time=0.01 for select sleep(0.1)
#---
#should NOT be written
set statement long_query_time=0.01,log_slow_min_examined_row_limit=50 for select sleep(0.1);
sleep(0.1)
0
select sql_text from mysql.slow_log where sql_text not like 'set @@long_query_time%';
sql_text
select sleep(0.1)
set statement long_query_time=0.01 for select sleep(0.1)
set statement log_slow_query_time=0.01 for select sleep(0.1)
#---
set global log_output= @save_log_output;
set @@slow_query_log= @save_slow_query_log;
......
......@@ -1018,6 +1018,10 @@ select sql_text from mysql.slow_log where sql_text not like 'set @@long_query_ti
set statement long_query_time=0.01 for select sleep(0.1);
select sql_text from mysql.slow_log where sql_text not like 'set @@long_query_time%';
--echo #---
--echo #should be written
set statement log_slow_query_time=0.01 for select sleep(0.1);
select sql_text from mysql.slow_log where sql_text not like 'set @@long_query_time%';
--echo #---
set @@long_query_time=0.01;
--echo #should NOT be written
set statement slow_query_log=0 for select sleep(0.1);
......@@ -1036,6 +1040,10 @@ select sql_text from mysql.slow_log where sql_text not like 'set @@long_query_ti
set statement long_query_time=0.01,min_examined_row_limit=50 for select sleep(0.1);
select sql_text from mysql.slow_log where sql_text not like 'set @@long_query_time%';
--echo #---
--echo #should NOT be written
set statement long_query_time=0.01,log_slow_min_examined_row_limit=50 for select sleep(0.1);
select sql_text from mysql.slow_log where sql_text not like 'set @@long_query_time%';
--echo #---
#
# log_slow_verbosity is impossible to check because results are not written
# in TABLE mode
......
'#--------------------FN_DYNVARS_018_01-------------------------#'
## Checking if my_slow_test.log exists in servers datadir ##
## This case should pass because we have set this filename in opt file ##
set @oldval= @@global.slow_query_log_file;
set global log_slow_query_file_name='$MYSQLTEST_VARDIR/tmp/slow-7567.log';
select @@global.log_slow_query_file_name;
@@global.log_slow_query_file_name
MYSQLTEST_VARDIR/tmp/slow-7567.log
set @@global.log_slow_query_file_name=@oldval;
......@@ -2,8 +2,8 @@ SET @global_slow_query_log = @@global.slow_query_log;
SET @global_log_output = @@global.log_output;
SET @@session.long_query_time=1;
SET @@global.log_output = 'TABLE';
'----When global.slow_query_log = OFF----'
SET @@global.slow_query_log = OFF;
'----When global.log_slow_query = OFF----'
SET @@global.log_slow_query = OFF;
TRUNCATE mysql.slow_log;
SELECT sleep(2);
sleep(2)
......@@ -20,8 +20,8 @@ sleep(2)
SELECT count(*) > 0 FROM mysql.slow_log;
count(*) > 0
1
'----When local.slow_query_log = OFF-----'
SET @@local.slow_query_log = OFF;
'----When local.log_slow_query = OFF-----'
SET @@local.log_slow_query = OFF;
TRUNCATE mysql.slow_log;
SELECT sleep(2);
sleep(2)
......
......@@ -1655,7 +1655,7 @@ COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME LOG_QUERIES_NOT_USING_INDEXES
VARIABLE_SCOPE SESSION
VARIABLE_TYPE BOOLEAN
VARIABLE_COMMENT Alias for log_slow_queries_not_using_indexes. Log queries that are executed without benefit of any index to the slow log if it is open. Same as log_slow_filter='not_using_index'
VARIABLE_COMMENT Log queries that are executed without benefit of any index to the slow log if it is open. Same as log_slow_filter='not_using_index'
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
......@@ -1702,17 +1702,7 @@ NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME LOG_SLOW_QUERIES_NOT_USING_INDEXES
VARIABLE_SCOPE SESSION
VARIABLE_TYPE BOOLEAN
VARIABLE_COMMENT Log queries that are executed without benefit of any index to the slow log if it is open. Same as log_slow_filter='not_using_index'
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST OFF,ON
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME LOG_SLOW_QUERY_ENABLE
VARIABLE_NAME LOG_SLOW_QUERY
VARIABLE_SCOPE SESSION
VARIABLE_TYPE BOOLEAN
VARIABLE_COMMENT Log slow queries to a table or log file. Defaults logging to a file 'hostname'-slow.log or a table mysql.slow_log if --log-output=TABLE is used. Must be enabled to activate other slow log options.
......@@ -3235,7 +3225,7 @@ COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME SLOW_QUERY_LOG
VARIABLE_SCOPE SESSION
VARIABLE_TYPE BOOLEAN
VARIABLE_COMMENT Alias for log_slow_query_enable. Log slow queries to a table or log file. Defaults logging to a file 'hostname'-slow.log or a table mysql.slow_log if --log-output=TABLE is used. Must be enabled to activate other slow log options.
VARIABLE_COMMENT Alias for log_slow_query. Log slow queries to a table or log file. Defaults logging to a file 'hostname'-slow.log or a table mysql.slow_log if --log-output=TABLE is used. Must be enabled to activate other slow log options.
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
......
......@@ -1795,7 +1795,7 @@ COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME LOG_QUERIES_NOT_USING_INDEXES
VARIABLE_SCOPE SESSION
VARIABLE_TYPE BOOLEAN
VARIABLE_COMMENT Alias for log_slow_queries_not_using_indexes. Log queries that are executed without benefit of any index to the slow log if it is open. Same as log_slow_filter='not_using_index'
VARIABLE_COMMENT Log queries that are executed without benefit of any index to the slow log if it is open. Same as log_slow_filter='not_using_index'
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
......@@ -1852,17 +1852,7 @@ NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME LOG_SLOW_QUERIES_NOT_USING_INDEXES
VARIABLE_SCOPE SESSION
VARIABLE_TYPE BOOLEAN
VARIABLE_COMMENT Log queries that are executed without benefit of any index to the slow log if it is open. Same as log_slow_filter='not_using_index'
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST OFF,ON
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME LOG_SLOW_QUERY_ENABLE
VARIABLE_NAME LOG_SLOW_QUERY
VARIABLE_SCOPE SESSION
VARIABLE_TYPE BOOLEAN
VARIABLE_COMMENT Log slow queries to a table or log file. Defaults logging to a file 'hostname'-slow.log or a table mysql.slow_log if --log-output=TABLE is used. Must be enabled to activate other slow log options.
......@@ -3915,7 +3905,7 @@ COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME SLOW_QUERY_LOG
VARIABLE_SCOPE SESSION
VARIABLE_TYPE BOOLEAN
VARIABLE_COMMENT Alias for log_slow_query_enable. Log slow queries to a table or log file. Defaults logging to a file 'hostname'-slow.log or a table mysql.slow_log if --log-output=TABLE is used. Must be enabled to activate other slow log options.
VARIABLE_COMMENT Alias for log_slow_query. Log slow queries to a table or log file. Defaults logging to a file 'hostname'-slow.log or a table mysql.slow_log if --log-output=TABLE is used. Must be enabled to activate other slow log options.
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
......
......@@ -31,3 +31,10 @@ let $MYSQLD_DATADIR= `select @@datadir`;
--file_exists $MYSQLD_DATADIR/my_slow_test.log
--echo ## This case should pass because we have set this filename in opt file ##
set @oldval= @@global.slow_query_log_file;
evalp set global log_slow_query_file_name='$MYSQLTEST_VARDIR/tmp/slow-7567.log';
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
select @@global.log_slow_query_file_name;
--file_exists $MYSQLTEST_VARDIR/tmp/slow-7567.log
set @@global.log_slow_query_file_name=@oldval;
......@@ -10,10 +10,10 @@ SET @@session.long_query_time=1;
SET @@global.log_output = 'TABLE';
#=========================================
--echo '----When global.slow_query_log = OFF----'
--echo '----When global.log_slow_query = OFF----'
#=========================================
SET @@global.slow_query_log = OFF;
SET @@global.log_slow_query = OFF;
TRUNCATE mysql.slow_log;
# The sleep is the slow query
SELECT sleep(2);
......@@ -32,10 +32,10 @@ SELECT sleep(2);
SELECT count(*) > 0 FROM mysql.slow_log;
#=========================================
--echo '----When local.slow_query_log = OFF-----'
--echo '----When local.log_slow_query = OFF-----'
#=========================================
SET @@local.slow_query_log = OFF;
SET @@local.log_slow_query = OFF;
TRUNCATE mysql.slow_log;
# The sleep is the slow query
SELECT sleep(2);
......
......@@ -1501,14 +1501,6 @@ static Sys_var_charptr_fscs Sys_log_error(
static Sys_var_bit Sys_log_queries_not_using_indexes(
"log_queries_not_using_indexes",
"Alias for log_slow_queries_not_using_indexes. "
"Log queries that are executed without benefit of any index to the "
"slow log if it is open. Same as log_slow_filter='not_using_index'",
SESSION_VAR(log_slow_filter), CMD_LINE(OPT_ARG), QPLAN_NOT_USING_INDEX,
DEFAULT(FALSE));
static Sys_var_bit Sys_log_slow_queries_not_using_indexes(
"log_slow_queries_not_using_indexes",
"Log queries that are executed without benefit of any index to the "
"slow log if it is open. Same as log_slow_filter='not_using_index'",
SESSION_VAR(log_slow_filter), CMD_LINE(OPT_ARG), QPLAN_NOT_USING_INDEX,
......@@ -5279,7 +5271,7 @@ static Sys_var_mybool Sys_general_log(
static Sys_var_mybool Sys_slow_query_log(
"slow_query_log",
"Alias for log_slow_query_enable. "
"Alias for log_slow_query. "
"Log slow queries to a table or log file. Defaults logging to a file "
"'hostname'-slow.log or a table mysql.slow_log if --log-output=TABLE is "
"used. Must be enabled to activate other slow log options.",
......@@ -5287,8 +5279,8 @@ static Sys_var_mybool Sys_slow_query_log(
DEFAULT(FALSE), NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(0), ON_UPDATE(fix_log_state));
static Sys_var_mybool Sys_log_slow_query_enable(
"log_slow_query_enable",
static Sys_var_mybool Sys_log_slow_query(
"log_slow_query",
"Log slow queries to a table or log file. Defaults logging to a file "
"'hostname'-slow.log or a table mysql.slow_log if --log-output=TABLE is "
"used. Must be enabled to activate other slow log options.",
......@@ -5313,7 +5305,7 @@ static bool fix_log_state(sys_var *self, THD *thd, enum_var_type type)
}
else
{
DBUG_ASSERT(self == &Sys_slow_query_log);
DBUG_ASSERT(self == &Sys_slow_query_log || self == &Sys_log_slow_query);
newvalptr= &global_system_variables.sql_log_slow;
oldval= logger.get_slow_log_file_handler()->is_open();
log_type= QUERY_LOG_SLOW;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment