Skip to content

Commit

Permalink
MDEV-7567 Add aliases with prefix log_slow for system variables relat…
Browse files Browse the repository at this point in the history
…ing 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
  • Loading branch information
vuvova committed Oct 4, 2022
1 parent af4918b commit ef08810
Show file tree
Hide file tree
Showing 14 changed files with 411 additions and 381 deletions.
3 changes: 1 addition & 2 deletions mysql-test/main/log_slow.result
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
26 changes: 13 additions & 13 deletions mysql-test/main/mysqld--help,win.rdiff
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,26 @@
--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.)
+ --standalone Dummy option to start as a standalone program (NT).
--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
Expand All @@ -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,
Expand All @@ -50,23 +50,23 @@
--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
+named-pipe FALSE
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
+slow-start-timeout 15000
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
Expand Down
24 changes: 8 additions & 16 deletions mysql-test/main/mysqld--help.result
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down
24 changes: 24 additions & 0 deletions mysql-test/main/set_statement.result
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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;
Expand Down
8 changes: 8 additions & 0 deletions mysql-test/main/set_statement.test
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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
Expand Down
6 changes: 6 additions & 0 deletions mysql-test/suite/sys_vars/r/slow_query_log_file_func.result
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
'#--------------------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;
8 changes: 4 additions & 4 deletions mysql-test/suite/sys_vars/r/slow_query_log_func.result
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
Loading

0 comments on commit ef08810

Please sign in to comment.