diff options
author | Alexander Barkov <bar@mariadb.com> | 2019-02-27 13:14:31 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.com> | 2019-03-04 13:49:15 +0400 |
commit | 19df45a705a48f5c8c21af0814cb5be7d816977b (patch) | |
tree | f4c4f13df3ff1bad07639e2e1be2ddc386b796bc /mysql-test | |
parent | f2e1451740d417f1c9ea8626d937fbcacc91bb55 (diff) | |
download | mariadb-git-19df45a705a48f5c8c21af0814cb5be7d816977b.tar.gz |
MDEV-18333 Slow_queries count doesn't increase when slow_query_log is turned off
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/log_slow.result | 37 | ||||
-rw-r--r-- | mysql-test/t/log_slow.test | 40 |
2 files changed, 77 insertions, 0 deletions
diff --git a/mysql-test/r/log_slow.result b/mysql-test/r/log_slow.result index 02e04cfbb2d..c50130a7b7a 100644 --- a/mysql-test/r/log_slow.result +++ b/mysql-test/r/log_slow.result @@ -76,3 +76,40 @@ set @@log_slow_filter=default; set @@log_slow_verbosity=default; set global log_output= default; truncate mysql.slow_log; +# +# MDEV-18333 Slow_queries count doesn't increase when slow_query_log is turned off +# +SET SESSION slow_query_log=OFF; +SET GLOBAL slow_query_log=OFF; +SET long_query_time=0.1; +# Although this query is disallowed by slow_query_log, it should still increment Slow_queries +SELECT VARIABLE_VALUE INTO @global_slow_queries +FROM INFORMATION_SCHEMA.GLOBAL_STATUS +WHERE VARIABLE_NAME='SLOW_QUERIES'; +SELECT sleep(0.2) INTO @tmp FROM DUAL; +SELECT +CAST(VARIABLE_VALUE AS UNSIGNED)-@global_slow_queries AS Slow_queries_increment +FROM +INFORMATION_SCHEMA.GLOBAL_STATUS +WHERE +VARIABLE_NAME='SLOW_QUERIES'; +Slow_queries_increment +1 +# Although this query is disallowed by log_slow_filter, it should still increment Slow_queries +SET log_slow_filter=filesort; +SELECT sleep(0.2) INTO @tmp FROM DUAL; +SELECT VARIABLE_VALUE INTO @global_slow_queries +FROM INFORMATION_SCHEMA.GLOBAL_STATUS +WHERE VARIABLE_NAME='SLOW_QUERIES'; +SELECT sleep(0.2) INTO @tmp FROM DUAL; +SELECT +CAST(VARIABLE_VALUE AS UNSIGNED)-@global_slow_queries AS Slow_queries_increment +FROM +INFORMATION_SCHEMA.GLOBAL_STATUS +WHERE +VARIABLE_NAME='SLOW_QUERIES'; +Slow_queries_increment +1 +SET log_slow_filter=DEFAULT; +SET @@long_query_time=default; +SET GLOBAL slow_query_log= @org_slow_query_log; diff --git a/mysql-test/t/log_slow.test b/mysql-test/t/log_slow.test index 56e35bd5a20..edb1865b5ae 100644 --- a/mysql-test/t/log_slow.test +++ b/mysql-test/t/log_slow.test @@ -58,3 +58,43 @@ set @@log_slow_filter=default; set @@log_slow_verbosity=default; set global log_output= default; truncate mysql.slow_log; + +--echo # +--echo # MDEV-18333 Slow_queries count doesn't increase when slow_query_log is turned off +--echo # + +SET SESSION slow_query_log=OFF; +SET GLOBAL slow_query_log=OFF; +SET long_query_time=0.1; + +--echo # Although this query is disallowed by slow_query_log, it should still increment Slow_queries + +SELECT VARIABLE_VALUE INTO @global_slow_queries + FROM INFORMATION_SCHEMA.GLOBAL_STATUS + WHERE VARIABLE_NAME='SLOW_QUERIES'; +SELECT sleep(0.2) INTO @tmp FROM DUAL; +SELECT + CAST(VARIABLE_VALUE AS UNSIGNED)-@global_slow_queries AS Slow_queries_increment + FROM + INFORMATION_SCHEMA.GLOBAL_STATUS + WHERE + VARIABLE_NAME='SLOW_QUERIES'; + +--echo # Although this query is disallowed by log_slow_filter, it should still increment Slow_queries + +SET log_slow_filter=filesort; +SELECT sleep(0.2) INTO @tmp FROM DUAL; +SELECT VARIABLE_VALUE INTO @global_slow_queries + FROM INFORMATION_SCHEMA.GLOBAL_STATUS + WHERE VARIABLE_NAME='SLOW_QUERIES'; +SELECT sleep(0.2) INTO @tmp FROM DUAL; +SELECT + CAST(VARIABLE_VALUE AS UNSIGNED)-@global_slow_queries AS Slow_queries_increment + FROM + INFORMATION_SCHEMA.GLOBAL_STATUS + WHERE + VARIABLE_NAME='SLOW_QUERIES'; +SET log_slow_filter=DEFAULT; + +SET @@long_query_time=default; +SET GLOBAL slow_query_log= @org_slow_query_log; |