1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

BUG#23300: Slow query log on slave does not log slow replicated statements

NOTE: this is the backport to next-mr.
      
When using replication, the slave will not log any slow query logs queries 
replicated from the master, even if the option "--log-slow-slave-statements" 
is set and these take more than "log_query_time" to execute.
              
In order to log slow queries in replicated thread one needs to set the
--log-slow-slave-statements, so that the SQL thread is initialized with the 
correct switch. Although setting this flag correctly configures the slave 
thread option to log slow queries, there is an issue with the condition that 
is used to check whether to log the slow query or not. When replaying binlog 
events the statement contains the SET TIMESTAMP clause which will force the 
slow logging condition check to fail. Consequently, the slow query logging will
not take place.
              
This patch addresses this issue by removing the second condition from the
log_slow_statements as it prevents slow queries to be binlogged and seems 
to be deprecated.
This commit is contained in:
Luis Soares
2009-09-29 15:09:01 +01:00
parent d94e279c7c
commit 01cdba58ba
5 changed files with 238 additions and 2 deletions

View File

@ -1615,9 +1615,9 @@ void log_slow_statement(THD *thd)
/*
Do not log administrative statements unless the appropriate option is
set; do not log into slow log if reading from backup.
set.
*/
if (thd->enable_slow_log && !thd->user_time)
if (thd->enable_slow_log)
{
ulonglong end_utime_of_query= thd->current_utime();
thd_proc_info(thd, "logging slow query");