mariadb/mysql-test/main/log_slow_always_query_time.test
Monty 40810baffe MDEV-33144 Implement the Percona variable slow_query_log_always_write_time
This task is inspired by the Percona implementation of
slow_query_log_always_write_time.

This task implements the variable log_slow_always_query_time (name
matching other MariaDB variables using the slow query log). The
default value for the variable is 31536000, which makes MariaDB
compatible with older installations.

For queries with execution time longer than log_slow_always_query_time
the variables log_slow_rate_limit and log_slow_min_examined_row_limit
will be ignored and the query will be written to the slow query log
if there is no other limitations (like log_slow_filter etc).

Other things:
- long_query_time internal variable renamed to log_slow_query_time.
- More descriptive information for "log_slow_query_time".
2024-11-01 08:58:37 +01:00

36 lines
1.1 KiB
Text

--source include/not_valgrind.inc
# We cannot use ps2 protocol as the test is counting number of executions
--disable_ps2_protocol
# View protocol disabled as it remove the tag from the SELECT query
--disable_view_protocol
#
# Test log_slow_always_query_time variable usage
#
--source include/log_slow_prepare.inc
--let $log_slow_prefix=log_slow_always_query_time
--let $log_file=$log_slow_prefix-1
select @@session.log_slow_always_query_time;
SET GLOBAL log_slow_always_query_time= 20.2;
SET SESSION log_slow_always_query_time=20.2;
select @@global.log_slow_always_query_time, @@session.log_slow_always_query_time;
set GLOBAL log_slow_always_query_time= default;
SET log_slow_query_time=0.5;
SET log_slow_rate_limit=999;
SET log_slow_always_query_time=1.5;
SET log_slow_min_examined_row_limit= 100;
--source include/log_slow_start.inc
SELECT sleep(2) as 'this-should-be-logged';
SELECT sleep(1) as 'this-should-not-be-logged';
--let grep_pattern=this-should
--let $log_expected_matches=1
--source include/log_grep.inc
--source include/log_slow_cleanup.inc
--enable_ps2_protocol