1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-05 13:16:09 +03:00

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".
This commit is contained in:
Monty
2023-12-31 12:41:25 +02:00
committed by Sergei Golubchik
parent bf9662f6fa
commit 40810baffe
11 changed files with 154 additions and 31 deletions

View File

@@ -2552,7 +2552,8 @@ void log_slow_statement(THD *thd)
}
if ((thd->server_status & SERVER_QUERY_WAS_SLOW) &&
thd->get_examined_row_count() >= thd->variables.min_examined_row_limit)
(thd->get_examined_row_count() >= thd->variables.min_examined_row_limit ||
thd->log_slow_always_query_time()))
{
thd->status_var.long_query_count++;
@@ -2572,6 +2573,7 @@ void log_slow_statement(THD *thd)
this query to the log or not.
*/
if (thd->variables.log_slow_rate_limit > 1 &&
!thd->log_slow_always_query_time() &&
(global_query_id % thd->variables.log_slow_rate_limit) != 0)
goto end;