summaryrefslogtreecommitdiff
path: root/sql/repl_failsafe.cc
diff options
context:
space:
mode:
authorguilhem@mysql.com <>2004-07-31 22:33:20 +0200
committerguilhem@mysql.com <>2004-07-31 22:33:20 +0200
commitdd023bc878104485e4c8cdc248c85b9c1daff34d (patch)
tree0f8a3d06ad26a2e3d61d38def3d87f5c2097ccaa /sql/repl_failsafe.cc
parentebd3745c8cfaae6998f702c74063828b54b0690d (diff)
downloadmariadb-git-dd023bc878104485e4c8cdc248c85b9c1daff34d.tar.gz
Fix for:
Bug #4810 "deadlock with KILL when the victim was in a wait state" (I included mutex unlock into exit_cond() for future safety) and BUG#4827 "KILL while START SLAVE may lead to replication slave crash"
Diffstat (limited to 'sql/repl_failsafe.cc')
-rw-r--r--sql/repl_failsafe.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc
index 1edf452d5f6..604938a8ed0 100644
--- a/sql/repl_failsafe.cc
+++ b/sql/repl_failsafe.cc
@@ -584,6 +584,8 @@ pthread_handler_decl(handle_failsafe_rpl,arg)
THD *thd = new THD;
thd->thread_stack = (char*)&thd;
MYSQL* recovery_captain = 0;
+ const char* msg;
+
pthread_detach_this_thread();
if (init_failsafe_rpl_thread(thd) || !(recovery_captain=mc_mysql_init(0)))
{
@@ -591,11 +593,11 @@ pthread_handler_decl(handle_failsafe_rpl,arg)
goto err;
}
pthread_mutex_lock(&LOCK_rpl_status);
+ msg= thd->enter_cond(&COND_rpl_status,
+ &LOCK_rpl_status, "Waiting for request");
while (!thd->killed && !abort_loop)
{
bool break_req_chain = 0;
- const char* msg = thd->enter_cond(&COND_rpl_status,
- &LOCK_rpl_status, "Waiting for request");
pthread_cond_wait(&COND_rpl_status, &LOCK_rpl_status);
thd->proc_info="Processing request";
while (!break_req_chain)
@@ -613,9 +615,8 @@ pthread_handler_decl(handle_failsafe_rpl,arg)
break;
}
}
- thd->exit_cond(msg);
}
- pthread_mutex_unlock(&LOCK_rpl_status);
+ thd->exit_cond(msg);
err:
if (recovery_captain)
mc_mysql_close(recovery_captain);