Commit 2362d984 authored by Michael Widenius's avatar Michael Widenius

MDEV-6698: safe_mutex: Found wrong usage of mutex 'log_space_lock' and 'LOCK_log'

Moved freeing of mutex earlier, as we don't need to have log_space_cond locked for doing rotate_relay_log()

sql/slave.cc:
  Moved freeing of mutex earlier, as we don't need to have log_space_cond locked for doing rotate_relay_log()
parent 9c79227c
...@@ -2230,6 +2230,7 @@ when it try to get the value of TIME_ZONE global variable from master."; ...@@ -2230,6 +2230,7 @@ when it try to get the value of TIME_ZONE global variable from master.";
static bool wait_for_relay_log_space(Relay_log_info* rli) static bool wait_for_relay_log_space(Relay_log_info* rli)
{ {
bool slave_killed=0; bool slave_killed=0;
bool ignore_log_space_limit;
Master_info* mi = rli->mi; Master_info* mi = rli->mi;
PSI_stage_info old_stage; PSI_stage_info old_stage;
THD* thd = mi->io_thd; THD* thd = mi->io_thd;
...@@ -2245,6 +2246,11 @@ static bool wait_for_relay_log_space(Relay_log_info* rli) ...@@ -2245,6 +2246,11 @@ static bool wait_for_relay_log_space(Relay_log_info* rli)
!rli->ignore_log_space_limit) !rli->ignore_log_space_limit)
mysql_cond_wait(&rli->log_space_cond, &rli->log_space_lock); mysql_cond_wait(&rli->log_space_cond, &rli->log_space_lock);
ignore_log_space_limit= rli->ignore_log_space_limit;
rli->ignore_log_space_limit= 0;
thd->EXIT_COND(&old_stage);
/* /*
Makes the IO thread read only one event at a time Makes the IO thread read only one event at a time
until the SQL thread is able to purge the relay until the SQL thread is able to purge the relay
...@@ -2268,7 +2274,8 @@ static bool wait_for_relay_log_space(Relay_log_info* rli) ...@@ -2268,7 +2274,8 @@ static bool wait_for_relay_log_space(Relay_log_info* rli)
thread sleeps waiting for events. thread sleeps waiting for events.
*/ */
if (rli->ignore_log_space_limit)
if (ignore_log_space_limit)
{ {
#ifndef DBUG_OFF #ifndef DBUG_OFF
{ {
...@@ -2290,11 +2297,8 @@ static bool wait_for_relay_log_space(Relay_log_info* rli) ...@@ -2290,11 +2297,8 @@ static bool wait_for_relay_log_space(Relay_log_info* rli)
mysql_mutex_unlock(&mi->data_lock); mysql_mutex_unlock(&mi->data_lock);
rli->sql_force_rotate_relay= false; rli->sql_force_rotate_relay= false;
} }
rli->ignore_log_space_limit= false;
} }
thd->EXIT_COND(&old_stage);
DBUG_RETURN(slave_killed); DBUG_RETURN(slave_killed);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment