summaryrefslogtreecommitdiff
path: root/sql/slave.cc
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2017-02-10 20:25:01 +0200
committerSergei Golubchik <serg@mariadb.org>2017-02-28 16:10:47 +0100
commitb624b41abb20b853cb033aa9b40bd0786e9d17fa (patch)
tree00f07732cfe7522ca35b4dbb637cb8c463b7d3dd /sql/slave.cc
parentd7a9aed43f6a77b2a4fcbc45b08d16b40be921ba (diff)
downloadmariadb-git-b624b41abb20b853cb033aa9b40bd0786e9d17fa.tar.gz
Don't allow one to kill START SLAVE while the slaves IO_THREAD or SQL_THREAD
is starting. This is needed as if we kill the START SLAVE thread too early during shutdown then the IO_THREAD or SQL_THREAD will not have time to properly initlize it's replication or THD structures and clean_up() will try to delete master_info structures that are still in use.
Diffstat (limited to 'sql/slave.cc')
-rw-r--r--sql/slave.cc18
1 files changed, 10 insertions, 8 deletions
diff --git a/sql/slave.cc b/sql/slave.cc
index 1634a56a4b6..1187031711d 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -831,6 +831,15 @@ int start_slave_thread(
mysql_mutex_unlock(start_lock);
DBUG_RETURN(ER_SLAVE_THREAD);
}
+
+ /*
+ In the following loop we can't check for thd->killed as we have to
+ wait until THD structures for the slave thread are created
+ before we can return.
+ This should be ok as there is no major work done in the slave
+ threads before they signal that we can stop waiting.
+ */
+
if (start_cond && cond_lock) // caller has cond_lock
{
THD* thd = current_thd;
@@ -848,16 +857,9 @@ int start_slave_thread(
registered, we could otherwise go waiting though thd->killed is
set.
*/
- if (!thd->killed)
- mysql_cond_wait(start_cond, cond_lock);
+ mysql_cond_wait(start_cond, cond_lock);
thd->EXIT_COND(& saved_stage);
mysql_mutex_lock(cond_lock); // re-acquire it as exit_cond() released
- if (thd->killed)
- {
- if (start_lock)
- mysql_mutex_unlock(start_lock);
- DBUG_RETURN(thd->killed_errno());
- }
}
}
if (start_lock)