summaryrefslogtreecommitdiff
path: root/sql/sql_repl.cc
diff options
context:
space:
mode:
authorunknown <rafal@quant.(none)>2007-02-03 20:14:16 +0100
committerunknown <rafal@quant.(none)>2007-02-03 20:14:16 +0100
commitd51d6adca7947c3fde0263b9f8da78788dc5b3f5 (patch)
tree58a1b330159900c872f5e7c6cd7c4b8fa24d92c4 /sql/sql_repl.cc
parent501bf6de184d073f6dea6bd2b5bdc6247499b4e3 (diff)
downloadmariadb-git-d51d6adca7947c3fde0263b9f8da78788dc5b3f5.tar.gz
BUG#25306 (Race conditions during replication slave shutdown (valgrind stacks)):
The possibility of the race is removed by changing sequence of calls pthread_mutex_unlock(&mi->run_lock); pthread_cond_broadcast(&mi->stop_cond); into pthread_cond_broadcast(&mi->stop_cond); pthread_mutex_unlock(&mi->run_lock); at the end of I/O thread (similar change at the end of SQL thread). This ensures that no thread waiting on the condition executes between the broadcast and the unlock and thus can't delete the mi structure which caused the bug. sql/slave.cc: Change order of condition broadcast and mutex unlock at the end of slave's I/O thread and SQL thread. sql/sql_repl.cc: Add DBUG_ENTER() call
Diffstat (limited to 'sql/sql_repl.cc')
-rw-r--r--sql/sql_repl.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index 88a752f7acb..004abc775bf 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -882,12 +882,14 @@ int start_slave(THD* thd , MASTER_INFO* mi, bool net_report)
int stop_slave(THD* thd, MASTER_INFO* mi, bool net_report )
{
+ DBUG_ENTER("stop_slave");
+
int slave_errno;
if (!thd)
thd = current_thd;
if (check_access(thd, SUPER_ACL, any_db,0,0,0,0))
- return 1;
+ DBUG_RETURN(1);
thd->proc_info = "Killing slave";
int thread_mask;
lock_slave_threads(mi);
@@ -921,12 +923,12 @@ int stop_slave(THD* thd, MASTER_INFO* mi, bool net_report )
{
if (net_report)
my_message(slave_errno, ER(slave_errno), MYF(0));
- return 1;
+ DBUG_RETURN(1);
}
else if (net_report)
send_ok(thd);
- return 0;
+ DBUG_RETURN(0);
}