Skip to content

Commit ef08810

Browse files
committed
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
1 parent af4918b commit ef08810

14 files changed

+411
-381
lines changed

mysql-test/main/log_slow.result

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ log_slow_admin_statements ON
1414
log_slow_disabled_statements sp
1515
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
1616
log_slow_min_examined_row_limit 0
17-
log_slow_queries_not_using_indexes OFF
18-
log_slow_query_enable ON
17+
log_slow_query ON
1918
log_slow_query_file_name $PATH/mysqld-slow.log
2019
log_slow_query_time 10.000000
2120
log_slow_rate_limit 1

mysql-test/main/mysqld--help,win.rdiff

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,26 @@
88
--net-buffer-length=#
99
Buffer length for TCP/IP and socket communication
1010
--net-read-timeout=#
11-
@@ -1275,6 +1276,10 @@
12-
will be written to the binlog. ENFORCE means that
13-
triggers will always be run on the slave, even if there
14-
are triggers on the master. ENFORCE implies LOGGING.
11+
@@ -1328,6 +1329,10 @@
12+
Alias for log_slow_query_file_name. Log slow queries to
13+
given log file. Defaults logging to 'hostname'-slow.log.
14+
Must be enabled to activate other slow log options
1515
+ --slow-start-timeout=#
1616
+ Maximum number of milliseconds that the service control
1717
+ manager should wait before trying to kill the windows
1818
+ service during startup(Default: 15000).
19-
--slave-skip-errors=name
20-
Tells the slave thread to continue replication when a
21-
query event returns an error from the provided list
22-
@@ -1343,6 +1348,7 @@
19+
--socket=name Socket file to use for connection
20+
--sort-buffer-size=#
21+
Each thread that needs to do a sort allocates a buffer of
22+
@@ -1352,6 +1357,7 @@
2323
deleting or updating every row in a table.
2424
--stack-trace Print a symbolic stack trace on failure
2525
(Defaults to on; use --skip-stack-trace to disable.)
2626
+ --standalone Dummy option to start as a standalone program (NT).
2727
--standard-compliant-cte
2828
Allow only CTEs compliant to SQL standard
2929
(Defaults to on; use --skip-standard-compliant-cte to disable.)
30-
@@ -1418,6 +1424,11 @@
30+
@@ -1427,6 +1433,11 @@
3131
--thread-pool-max-threads=#
3232
Maximum allowed number of worker threads in the thread
3333
pool
@@ -39,7 +39,7 @@
3939
--thread-pool-oversubscribe=#
4040
How many additional active worker threads in a group are
4141
allowed.
42-
@@ -1456,8 +1467,8 @@
42+
@@ -1465,8 +1476,8 @@
4343
automatically convert it to an on-disk MyISAM or Aria
4444
table.
4545
-t, --tmpdir=name Path for temporary files. Several paths may be specified,
@@ -50,23 +50,23 @@
5050
--transaction-alloc-block-size=#
5151
Allocation block size for transactions to be stored in
5252
binary log
53-
@@ -1678,6 +1689,7 @@
53+
@@ -1686,6 +1697,7 @@
5454
myisam-stats-method NULLS_UNEQUAL
5555
myisam-use-mmap FALSE
5656
mysql56-temporal-format TRUE
5757
+named-pipe FALSE
5858
net-buffer-length 16384
5959
net-read-timeout 30
6060
net-retry-count 10
61-
@@ -1832,6 +1844,7 @@
61+
@@ -1842,6 +1854,7 @@
6262
slave-type-conversions
6363
slow-launch-time 2
6464
slow-query-log FALSE
6565
+slow-start-timeout 15000
6666
sort-buffer-size 2097152
6767
sql-mode STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
6868
sql-safe-updates FALSE
69-
@@ -1858,6 +1871,8 @@
69+
@@ -1868,6 +1881,8 @@
7070
thread-pool-exact-stats FALSE
7171
thread-pool-idle-timeout 60
7272
thread-pool-max-threads 65536

mysql-test/main/mysqld--help.result

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -497,9 +497,8 @@ The following specify which files/extra groups are read (specified before remain
497497
--log-output=name How logs should be written. Any combination of: NONE,
498498
FILE, TABLE
499499
--log-queries-not-using-indexes
500-
Alias for log_slow_queries_not_using_indexes. Log queries
501-
that are executed without benefit of any index to the
502-
slow log if it is open. Same as
500+
Log queries that are executed without benefit of any
501+
index to the slow log if it is open. Same as
503502
log_slow_filter='not_using_index'
504503
--log-short-format Don't log extra information to update and slow-query
505504
logs.
@@ -527,12 +526,7 @@ The following specify which files/extra groups are read (specified before remain
527526
--log-slow-min-examined-row-limit=#
528527
Don't write queries to slow log that examine fewer rows
529528
than that
530-
--log-slow-queries-not-using-indexes
531-
Log queries that are executed without benefit of any
532-
index to the slow log if it is open. Same as
533-
log_slow_filter='not_using_index'
534-
--log-slow-query-enable
535-
Log slow queries to a table or log file. Defaults logging
529+
--log-slow-query Log slow queries to a table or log file. Defaults logging
536530
to a file 'hostname'-slow.log or a table mysql.slow_log
537531
if --log-output=TABLE is used. Must be enabled to
538532
activate other slow log options.
@@ -1326,11 +1320,10 @@ The following specify which files/extra groups are read (specified before remain
13261320
If creating the thread takes longer than this value (in
13271321
seconds), the Slow_launch_threads counter will be
13281322
incremented
1329-
--slow-query-log Alias for log_slow_query_enable. Log slow queries to a
1330-
table or log file. Defaults logging to a file
1331-
'hostname'-slow.log or a table mysql.slow_log if
1332-
--log-output=TABLE is used. Must be enabled to activate
1333-
other slow log options.
1323+
--slow-query-log Alias for log_slow_query. Log slow queries to a table or
1324+
log file. Defaults logging to a file 'hostname'-slow.log
1325+
or a table mysql.slow_log if --log-output=TABLE is used.
1326+
Must be enabled to activate other slow log options.
13341327
--slow-query-log-file=name
13351328
Alias for log_slow_query_file_name. Log slow queries to
13361329
given log file. Defaults logging to 'hostname'-slow.log.
@@ -1641,8 +1634,7 @@ log-slow-admin-statements TRUE
16411634
log-slow-disabled-statements sp
16421635
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
16431636
log-slow-min-examined-row-limit 0
1644-
log-slow-queries-not-using-indexes FALSE
1645-
log-slow-query-enable FALSE
1637+
log-slow-query FALSE
16461638
log-slow-query-time 10
16471639
log-slow-rate-limit 1
16481640
log-slow-slave-statements TRUE

mysql-test/main/set_statement.result

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1147,6 +1147,16 @@ sql_text
11471147
select sleep(0.1)
11481148
set statement long_query_time=0.01 for select sleep(0.1)
11491149
#---
1150+
#should be written
1151+
set statement log_slow_query_time=0.01 for select sleep(0.1);
1152+
sleep(0.1)
1153+
0
1154+
select sql_text from mysql.slow_log where sql_text not like 'set @@long_query_time%';
1155+
sql_text
1156+
select sleep(0.1)
1157+
set statement long_query_time=0.01 for select sleep(0.1)
1158+
set statement log_slow_query_time=0.01 for select sleep(0.1)
1159+
#---
11501160
set @@long_query_time=0.01;
11511161
#should NOT be written
11521162
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
11571167
sql_text
11581168
select sleep(0.1)
11591169
set statement long_query_time=0.01 for select sleep(0.1)
1170+
set statement log_slow_query_time=0.01 for select sleep(0.1)
11601171
#---
11611172
#should NOT be written
11621173
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
11661177
sql_text
11671178
select sleep(0.1)
11681179
set statement long_query_time=0.01 for select sleep(0.1)
1180+
set statement log_slow_query_time=0.01 for select sleep(0.1)
11691181
#---
11701182
#should NOT be written
11711183
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
11751187
sql_text
11761188
select sleep(0.1)
11771189
set statement long_query_time=0.01 for select sleep(0.1)
1190+
set statement log_slow_query_time=0.01 for select sleep(0.1)
11781191
#---
11791192
#should NOT be written
11801193
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
11841197
sql_text
11851198
select sleep(0.1)
11861199
set statement long_query_time=0.01 for select sleep(0.1)
1200+
set statement log_slow_query_time=0.01 for select sleep(0.1)
1201+
#---
1202+
#should NOT be written
1203+
set statement long_query_time=0.01,log_slow_min_examined_row_limit=50 for select sleep(0.1);
1204+
sleep(0.1)
1205+
0
1206+
select sql_text from mysql.slow_log where sql_text not like 'set @@long_query_time%';
1207+
sql_text
1208+
select sleep(0.1)
1209+
set statement long_query_time=0.01 for select sleep(0.1)
1210+
set statement log_slow_query_time=0.01 for select sleep(0.1)
11871211
#---
11881212
set global log_output= @save_log_output;
11891213
set @@slow_query_log= @save_slow_query_log;

mysql-test/main/set_statement.test

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,6 +1018,10 @@ select sql_text from mysql.slow_log where sql_text not like 'set @@long_query_ti
10181018
set statement long_query_time=0.01 for select sleep(0.1);
10191019
select sql_text from mysql.slow_log where sql_text not like 'set @@long_query_time%';
10201020
--echo #---
1021+
--echo #should be written
1022+
set statement log_slow_query_time=0.01 for select sleep(0.1);
1023+
select sql_text from mysql.slow_log where sql_text not like 'set @@long_query_time%';
1024+
--echo #---
10211025
set @@long_query_time=0.01;
10221026
--echo #should NOT be written
10231027
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
10361040
set statement long_query_time=0.01,min_examined_row_limit=50 for select sleep(0.1);
10371041
select sql_text from mysql.slow_log where sql_text not like 'set @@long_query_time%';
10381042
--echo #---
1043+
--echo #should NOT be written
1044+
set statement long_query_time=0.01,log_slow_min_examined_row_limit=50 for select sleep(0.1);
1045+
select sql_text from mysql.slow_log where sql_text not like 'set @@long_query_time%';
1046+
--echo #---
10391047
#
10401048
# log_slow_verbosity is impossible to check because results are not written
10411049
# in TABLE mode
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
'#--------------------FN_DYNVARS_018_01-------------------------#'
22
## Checking if my_slow_test.log exists in servers datadir ##
33
## This case should pass because we have set this filename in opt file ##
4+
set @oldval= @@global.slow_query_log_file;
5+
set global log_slow_query_file_name='$MYSQLTEST_VARDIR/tmp/slow-7567.log';
6+
select @@global.log_slow_query_file_name;
7+
@@global.log_slow_query_file_name
8+
MYSQLTEST_VARDIR/tmp/slow-7567.log
9+
set @@global.log_slow_query_file_name=@oldval;

mysql-test/suite/sys_vars/r/slow_query_log_func.result

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ SET @global_slow_query_log = @@global.slow_query_log;
22
SET @global_log_output = @@global.log_output;
33
SET @@session.long_query_time=1;
44
SET @@global.log_output = 'TABLE';
5-
'----When global.slow_query_log = OFF----'
6-
SET @@global.slow_query_log = OFF;
5+
'----When global.log_slow_query = OFF----'
6+
SET @@global.log_slow_query = OFF;
77
TRUNCATE mysql.slow_log;
88
SELECT sleep(2);
99
sleep(2)
@@ -20,8 +20,8 @@ sleep(2)
2020
SELECT count(*) > 0 FROM mysql.slow_log;
2121
count(*) > 0
2222
1
23-
'----When local.slow_query_log = OFF-----'
24-
SET @@local.slow_query_log = OFF;
23+
'----When local.log_slow_query = OFF-----'
24+
SET @@local.log_slow_query = OFF;
2525
TRUNCATE mysql.slow_log;
2626
SELECT sleep(2);
2727
sleep(2)

0 commit comments

Comments
 (0)