Commit b624b41a authored by Monty's avatar Monty Committed by Sergei Golubchik

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.
parent d7a9aed4
......@@ -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)
......
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