Commit 49b25020 authored by Kristian Nielsen's avatar Kristian Nielsen

Fix assertion/hang in read_init_file()

If there are other threads running (for example binlog background
thread), then the thread count may not drop to zero at the end of
do_handle_bootstrap(). This caused an assertion and missing wakeup of
the main thread. The missing wakeup is because THD::~THD() only
signals the COND_thread_count mutex when the number of threads drops
to zero.
Signed-off-by: default avatarKristian Nielsen <knielsen@knielsen-hq.org>
parent be2b833c
...@@ -1082,9 +1082,20 @@ void do_handle_bootstrap(THD *thd) ...@@ -1082,9 +1082,20 @@ void do_handle_bootstrap(THD *thd)
end: end:
in_bootstrap= FALSE; in_bootstrap= FALSE;
delete thd; delete thd;
if (!opt_bootstrap)
{
/*
We need to wake up main thread in case of read_init_file().
This is not done by THD::~THD() when there are other threads running
(binlog background thread, for example). So do it here again.
*/
mysql_mutex_lock(&LOCK_thread_count);
mysql_cond_broadcast(&COND_thread_count);
mysql_mutex_unlock(&LOCK_thread_count);
}
#ifndef EMBEDDED_LIBRARY #ifndef EMBEDDED_LIBRARY
DBUG_ASSERT(thread_count == 0); DBUG_ASSERT(!opt_bootstrap || thread_count == 0);
my_thread_end(); my_thread_end();
pthread_exit(0); pthread_exit(0);
#endif #endif
......
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