mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
MDEV-27161: Add option for SQL thread to limit maximum execution time per query replicated
New Feature: ============ This patch adds a new system variable, @@slave_max_statement_time, which limits the execution time of s slave’s events that implements an equivalent to @@max_statement_time for slave applier. Reviewed By: ============ Andrei Elkin <andrei.elkin@mariadb.com>
This commit is contained in:
committed by
Andrei
parent
7864d955f3
commit
360d99429c
@@ -5431,24 +5431,29 @@ public:
|
||||
void set_query_timer()
|
||||
{
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
/*
|
||||
Slave vs user threads have timeouts configured via different variables,
|
||||
so pick the appropriate one to use.
|
||||
*/
|
||||
ulonglong timeout_val=
|
||||
slave_thread ? slave_max_statement_time : variables.max_statement_time;
|
||||
|
||||
/*
|
||||
Don't start a query timer if
|
||||
- If timeouts are not set
|
||||
- if we are in a stored procedure or sub statement
|
||||
- If this is a slave thread
|
||||
- If we already have set a timeout (happens when running prepared
|
||||
statements that calls mysql_execute_command())
|
||||
*/
|
||||
if (!variables.max_statement_time || spcont || in_sub_stmt ||
|
||||
slave_thread || query_timer.expired == 0)
|
||||
if (!timeout_val || spcont || in_sub_stmt || query_timer.expired == 0)
|
||||
return;
|
||||
thr_timer_settime(&query_timer, variables.max_statement_time);
|
||||
thr_timer_settime(&query_timer, timeout_val);
|
||||
#endif
|
||||
}
|
||||
void reset_query_timer()
|
||||
{
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
if (spcont || in_sub_stmt || slave_thread)
|
||||
if (spcont || in_sub_stmt)
|
||||
return;
|
||||
if (!query_timer.expired)
|
||||
thr_timer_end(&query_timer);
|
||||
|
Reference in New Issue
Block a user