Skip to content

Commit af4918b

Browse files
michaelqin3vuvova
authored andcommitted
MDEV-7567 Add aliases with prefix log_slow for system variables relating to slow query log.
Thus, all these variables will be grouped together and more logically named. Descriptions for the old variables were updated to indicate they are now aliases for the newly introduced variables with prefix log_slow. log_slow_queries_not_using_indexes_filter will not be addressed in this merge request. log_throttle_queries_not_using_indexes seems to no longer be in use. MTR tests are also updated to include the new variable names. All new code of the whole pull request, including one or several files that are either new files or modified ones, are contributed under the BSD-new license. I am contributing on behalf of my employer Amazon Web Services, Inc.
1 parent 315f2e8 commit af4918b

File tree

8 files changed

+225
-44
lines changed

8 files changed

+225
-44
lines changed

mysql-test/main/log_slow.result

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ Variable_name Value
1313
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
16+
log_slow_min_examined_row_limit 0
17+
log_slow_queries_not_using_indexes OFF
18+
log_slow_query_enable ON
19+
log_slow_query_file_name $PATH/mysqld-slow.log
20+
log_slow_query_time 10.000000
1621
log_slow_rate_limit 1
1722
log_slow_slave_statements ON
1823
log_slow_verbosity

mysql-test/main/log_slow.test

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ set @@log_slow_verbosity="";
77
select @@log_slow_filter;
88
select @@log_slow_rate_limit;
99
select @@log_slow_verbosity;
10+
--replace_regex /\S+mysqld-slow.log/$PATH\/mysqld-slow.log/
1011
show variables like "log_slow%";
1112
set @org_slow_query_log= @@global.slow_query_log;
1213

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

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
11
--- a/mysql-test/r/mysqld--help.result
22
+++ b/mysql-test/r/mysqld--help.result
3-
@@ -647,6 +646,7 @@
3+
@@ -686,6 +686,7 @@
44
Use MySQL-5.6 (instead of MariaDB-5.3) format for TIME,
55
DATETIME, TIMESTAMP columns.
66
(Defaults to on; use --skip-mysql56-temporal-format to disable.)
77
+ --named-pipe Enable the named pipe (NT)
88
--net-buffer-length=#
99
Buffer length for TCP/IP and socket communication
1010
--net-read-timeout=#
11-
@@ -1236,6 +1236,10 @@
12-
Log slow queries to given log file. Defaults logging to
13-
'hostname'-slow.log. Must be enabled to activate other
14-
slow log options
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.
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-
--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-
@@ -1260,6 +1264,7 @@
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 @@
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-
@@ -1330,6 +1335,11 @@
30+
@@ -1418,6 +1424,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-
@@ -1370,8 +1380,8 @@
42+
@@ -1456,8 +1467,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,24 +50,24 @@
5050
--transaction-alloc-block-size=#
5151
Allocation block size for transactions to be stored in
5252
binary log
53-
@@ -1587,6 +1596,7 @@
53+
@@ -1678,6 +1689,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-
@@ -1726,6 +1736,7 @@
61+
@@ -1832,6 +1844,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-
@@ -1753,6 +1764,8 @@
70-
thread-cache-size 151
69+
@@ -1858,6 +1871,8 @@
70+
thread-pool-exact-stats FALSE
7171
thread-pool-idle-timeout 60
7272
thread-pool-max-threads 65536
7373
+thread-pool-min-threads 1

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

Lines changed: 42 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -497,8 +497,9 @@ 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-
Log queries that are executed without benefit of any
501-
index to the slow log if it is open. Same as
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
502503
log_slow_filter='not_using_index'
503504
--log-short-format Don't log extra information to update and slow-query
504505
logs.
@@ -523,6 +524,27 @@ The following specify which files/extra groups are read (specified before remain
523524
filesort_priority_queue, full_join, full_scan,
524525
not_using_index, query_cache, query_cache_miss, tmp_table,
525526
tmp_table_on_disk
527+
--log-slow-min-examined-row-limit=#
528+
Don't write queries to slow log that examine fewer rows
529+
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
536+
to a file 'hostname'-slow.log or a table mysql.slow_log
537+
if --log-output=TABLE is used. Must be enabled to
538+
activate other slow log options.
539+
--log-slow-query-file-name=name
540+
Log slow queries to given log file. Defaults logging to
541+
'hostname'-slow.log. Must be enabled to activate other
542+
slow log options
543+
--log-slow-query-time=#
544+
Log all queries that have taken more than
545+
log_slow_query_time seconds to execute to the slow query
546+
log file. The argument will be treated as a decimal value
547+
with microsecond precision
526548
--log-slow-rate-limit=#
527549
Write to slow log every #th slow query. Set to 1 to log
528550
everything. Increase it to reduce the size of the slow or
@@ -543,10 +565,10 @@ The following specify which files/extra groups are read (specified before remain
543565
Log some not critical warnings to the general log
544566
file.Value can be between 0 and 11. Higher values mean
545567
more verbosity
546-
--long-query-time=# Log all queries that have taken more than long_query_time
547-
seconds to execute to the slow query log file. The
548-
argument will be treated as a decimal value with
549-
microsecond precision
568+
--long-query-time=# Alias for log_slow_query_time. Log all queries that have
569+
taken more than long_query_time seconds to execute to the
570+
slow query log file. The argument will be treated as a
571+
decimal value with microsecond precision
550572
--low-priority-updates
551573
INSERT/DELETE/UPDATE has lower priority than selects
552574
--lower-case-table-names[=#]
@@ -635,8 +657,8 @@ The following specify which files/extra groups are read (specified before remain
635657
--metadata-locks-hash-instances=#
636658
Unused
637659
--min-examined-row-limit=#
638-
Don't write queries to slow log that examine fewer rows
639-
than that
660+
Alias for log_slow_min_examined_row_limit. Don't write
661+
queries to slow log that examine fewer rows than that
640662
--mrr-buffer-size=# Size of buffer to use when using MRR with range access
641663
--myisam-block-size=#
642664
Block size to be used for MyISAM index pages
@@ -1304,14 +1326,15 @@ The following specify which files/extra groups are read (specified before remain
13041326
If creating the thread takes longer than this value (in
13051327
seconds), the Slow_launch_threads counter will be
13061328
incremented
1307-
--slow-query-log Log slow queries to a table or log file. Defaults logging
1308-
to a file 'hostname'-slow.log or a table mysql.slow_log
1309-
if --log-output=TABLE is used. Must be enabled to
1310-
activate other slow log options.
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.
13111334
--slow-query-log-file=name
1312-
Log slow queries to given log file. Defaults logging to
1313-
'hostname'-slow.log. Must be enabled to activate other
1314-
slow log options
1335+
Alias for log_slow_query_file_name. Log slow queries to
1336+
given log file. Defaults logging to 'hostname'-slow.log.
1337+
Must be enabled to activate other slow log options
13151338
--socket=name Socket file to use for connection
13161339
--sort-buffer-size=#
13171340
Each thread that needs to do a sort allocates a buffer of
@@ -1617,6 +1640,10 @@ log-slave-updates FALSE
16171640
log-slow-admin-statements TRUE
16181641
log-slow-disabled-statements sp
16191642
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
1643+
log-slow-min-examined-row-limit 0
1644+
log-slow-queries-not-using-indexes FALSE
1645+
log-slow-query-enable FALSE
1646+
log-slow-query-time 10
16201647
log-slow-rate-limit 1
16211648
log-slow-slave-statements TRUE
16221649
log-slow-verbosity

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ perl;
2323
# their paths may vary:
2424
@skipvars=qw/basedir open-files-limit general-log-file log plugin-dir plugin-maturity
2525
log-slow-queries pid-file slow-query-log-file log-basename
26+
log-slow-query-file-name
2627
datadir slave-load-tmpdir tmpdir socket thread-pool-size
2728
large-files-support lower-case-file-system system-time-zone
2829
collation-server character-set-server log-tc-size table-cache

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

Lines changed: 56 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1655,7 +1655,7 @@ COMMAND_LINE_ARGUMENT REQUIRED
16551655
VARIABLE_NAME LOG_QUERIES_NOT_USING_INDEXES
16561656
VARIABLE_SCOPE SESSION
16571657
VARIABLE_TYPE BOOLEAN
1658-
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'
1658+
VARIABLE_COMMENTAlias 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'
16591659
NUMERIC_MIN_VALUE NULL
16601660
NUMERIC_MAX_VALUE NULL
16611661
NUMERIC_BLOCK_SIZE NULL
@@ -1692,6 +1692,56 @@ NUMERIC_BLOCK_SIZE NULL
16921692
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
16931693
READ_ONLY NO
16941694
COMMAND_LINE_ARGUMENT REQUIRED
1695+
VARIABLE_NAME LOG_SLOW_MIN_EXAMINED_ROW_LIMIT
1696+
VARIABLE_SCOPE SESSION
1697+
VARIABLE_TYPE BIGINT UNSIGNED
1698+
VARIABLE_COMMENT Don't write queries to slow log that examine fewer rows than that
1699+
NUMERIC_MIN_VALUE 0
1700+
NUMERIC_MAX_VALUE 4294967295
1701+
NUMERIC_BLOCK_SIZE 1
1702+
ENUM_VALUE_LIST NULL
1703+
READ_ONLY NO
1704+
COMMAND_LINE_ARGUMENT REQUIRED
1705+
VARIABLE_NAME LOG_SLOW_QUERIES_NOT_USING_INDEXES
1706+
VARIABLE_SCOPE SESSION
1707+
VARIABLE_TYPE BOOLEAN
1708+
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'
1709+
NUMERIC_MIN_VALUE NULL
1710+
NUMERIC_MAX_VALUE NULL
1711+
NUMERIC_BLOCK_SIZE NULL
1712+
ENUM_VALUE_LIST OFF,ON
1713+
READ_ONLY NO
1714+
COMMAND_LINE_ARGUMENT OPTIONAL
1715+
VARIABLE_NAME LOG_SLOW_QUERY_ENABLE
1716+
VARIABLE_SCOPE SESSION
1717+
VARIABLE_TYPE BOOLEAN
1718+
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.
1719+
NUMERIC_MIN_VALUE NULL
1720+
NUMERIC_MAX_VALUE NULL
1721+
NUMERIC_BLOCK_SIZE NULL
1722+
ENUM_VALUE_LIST OFF,ON
1723+
READ_ONLY NO
1724+
COMMAND_LINE_ARGUMENT OPTIONAL
1725+
VARIABLE_NAME LOG_SLOW_QUERY_FILE_NAME
1726+
VARIABLE_SCOPE GLOBAL
1727+
VARIABLE_TYPE VARCHAR
1728+
VARIABLE_COMMENT Log slow queries to given log file. Defaults logging to 'hostname'-slow.log. Must be enabled to activate other slow log options
1729+
NUMERIC_MIN_VALUE NULL
1730+
NUMERIC_MAX_VALUE NULL
1731+
NUMERIC_BLOCK_SIZE NULL
1732+
ENUM_VALUE_LIST NULL
1733+
READ_ONLY NO
1734+
COMMAND_LINE_ARGUMENT REQUIRED
1735+
VARIABLE_NAME LOG_SLOW_QUERY_TIME
1736+
VARIABLE_SCOPE SESSION
1737+
VARIABLE_TYPE DOUBLE
1738+
VARIABLE_COMMENT Log all queries that have taken more than log_slow_query_time seconds to execute to the slow query log file. The argument will be treated as a decimal value with microsecond precision
1739+
NUMERIC_MIN_VALUE 0
1740+
NUMERIC_MAX_VALUE 31536000
1741+
NUMERIC_BLOCK_SIZE NULL
1742+
ENUM_VALUE_LIST NULL
1743+
READ_ONLY NO
1744+
COMMAND_LINE_ARGUMENT REQUIRED
16951745
VARIABLE_NAME LOG_SLOW_RATE_LIMIT
16961746
VARIABLE_SCOPE SESSION
16971747
VARIABLE_TYPE BIGINT UNSIGNED
@@ -1735,7 +1785,7 @@ COMMAND_LINE_ARGUMENT OPTIONAL
17351785
VARIABLE_NAME LONG_QUERY_TIME
17361786
VARIABLE_SCOPE SESSION
17371787
VARIABLE_TYPE DOUBLE
1738-
VARIABLE_COMMENT Log all queries that have taken more than long_query_time seconds to execute to the slow query log file. The argument will be treated as a decimal value with microsecond precision
1788+
VARIABLE_COMMENTAlias for log_slow_query_time. Log all queries that have taken more than long_query_time seconds to execute to the slow query log file. The argument will be treated as a decimal value with microsecond precision
17391789
NUMERIC_MIN_VALUE 0
17401790
NUMERIC_MAX_VALUE 31536000
17411791
NUMERIC_BLOCK_SIZE NULL
@@ -1875,7 +1925,7 @@ COMMAND_LINE_ARGUMENT REQUIRED
18751925
VARIABLE_NAME MAX_INSERT_DELAYED_THREADS
18761926
VARIABLE_SCOPE SESSION
18771927
VARIABLE_TYPE BIGINT UNSIGNED
1878-
VARIABLE_COMMENT Don't start more than this number of threads to handle INSERT DELAYED statements. If set to zero INSERT DELAYED will be not used
1928+
VARIABLE_COMMENTAlias for max_delayed_threads. Don't start more than this number of threads to handle INSERT DELAYED statements. If set to zero INSERT DELAYED will be not used
18791929
NUMERIC_MIN_VALUE 0
18801930
NUMERIC_MAX_VALUE 16384
18811931
NUMERIC_BLOCK_SIZE 1
@@ -2045,7 +2095,7 @@ COMMAND_LINE_ARGUMENT REQUIRED
20452095
VARIABLE_NAME MIN_EXAMINED_ROW_LIMIT
20462096
VARIABLE_SCOPE SESSION
20472097
VARIABLE_TYPE BIGINT UNSIGNED
2048-
VARIABLE_COMMENT Don't write queries to slow log that examine fewer rows than that
2098+
VARIABLE_COMMENTAlias for log_slow_min_examined_row_limit. Don't write queries to slow log that examine fewer rows than that
20492099
NUMERIC_MIN_VALUE 0
20502100
NUMERIC_MAX_VALUE 4294967295
20512101
NUMERIC_BLOCK_SIZE 1
@@ -3185,7 +3235,7 @@ COMMAND_LINE_ARGUMENT REQUIRED
31853235
VARIABLE_NAME SLOW_QUERY_LOG
31863236
VARIABLE_SCOPE SESSION
31873237
VARIABLE_TYPE BOOLEAN
3188-
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.
3238+
VARIABLE_COMMENTAlias 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.
31893239
NUMERIC_MIN_VALUE NULL
31903240
NUMERIC_MAX_VALUE NULL
31913241
NUMERIC_BLOCK_SIZE NULL
@@ -3195,7 +3245,7 @@ COMMAND_LINE_ARGUMENT OPTIONAL
31953245
VARIABLE_NAME SLOW_QUERY_LOG_FILE
31963246
VARIABLE_SCOPE GLOBAL
31973247
VARIABLE_TYPE VARCHAR
3198-
VARIABLE_COMMENT Log slow queries to given log file. Defaults logging to 'hostname'-slow.log. Must be enabled to activate other slow log options
3248+
VARIABLE_COMMENTAlias 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
31993249
NUMERIC_MIN_VALUE NULL
32003250
NUMERIC_MAX_VALUE NULL
32013251
NUMERIC_BLOCK_SIZE NULL

0 commit comments

Comments
 (0)