Commit 22a00977 authored by Kentoku SHIBA's avatar Kentoku SHIBA

MDEV-22979 "mysqld --bootstrap" / mysql_install_db hangs when Spider is installed

parent e6e41f04
...@@ -9876,6 +9876,7 @@ void spider_free_sts_threads( ...@@ -9876,6 +9876,7 @@ void spider_free_sts_threads(
) { ) {
bool thread_killed; bool thread_killed;
DBUG_ENTER("spider_free_sts_threads"); DBUG_ENTER("spider_free_sts_threads");
spider_thread->init_command = FALSE;
pthread_mutex_lock(&spider_thread->mutex); pthread_mutex_lock(&spider_thread->mutex);
thread_killed = spider_thread->killed; thread_killed = spider_thread->killed;
spider_thread->killed = TRUE; spider_thread->killed = TRUE;
...@@ -10032,12 +10033,13 @@ void *spider_table_bg_sts_action( ...@@ -10032,12 +10033,13 @@ void *spider_table_bg_sts_action(
tmp_disable_binlog(thd); tmp_disable_binlog(thd);
thd->security_ctx->skip_grants(); thd->security_ctx->skip_grants();
thd->client_capabilities |= CLIENT_MULTI_RESULTS; thd->client_capabilities |= CLIENT_MULTI_RESULTS;
if (!(*spd_mysqld_server_started) && !thd->killed) if (!(*spd_mysqld_server_started) && !thd->killed && !thread->killed)
{ {
pthread_mutex_lock(spd_LOCK_server_started); pthread_mutex_lock(spd_LOCK_server_started);
thd->mysys_var->current_cond = spd_COND_server_started; thd->mysys_var->current_cond = spd_COND_server_started;
thd->mysys_var->current_mutex = spd_LOCK_server_started; thd->mysys_var->current_mutex = spd_LOCK_server_started;
if (!(*spd_mysqld_server_started) && !thd->killed) if (!(*spd_mysqld_server_started) && !thd->killed && !thread->killed &&
thread->init_command)
{ {
do do
{ {
...@@ -10047,14 +10049,16 @@ void *spider_table_bg_sts_action( ...@@ -10047,14 +10049,16 @@ void *spider_table_bg_sts_action(
spd_LOCK_server_started, &abstime); spd_LOCK_server_started, &abstime);
} while ( } while (
(error_num == ETIMEDOUT || error_num == ETIME) && (error_num == ETIMEDOUT || error_num == ETIME) &&
!(*spd_mysqld_server_started) && !thd->killed && !thread->killed !(*spd_mysqld_server_started) && !thd->killed && !thread->killed &&
thread->init_command
); );
} }
pthread_mutex_unlock(spd_LOCK_server_started); pthread_mutex_unlock(spd_LOCK_server_started);
thd->mysys_var->current_cond = &thread->cond; thd->mysys_var->current_cond = &thread->cond;
thd->mysys_var->current_mutex = &thread->mutex; thd->mysys_var->current_mutex = &thread->mutex;
} }
while (spider_init_queries[i].length && !thd->killed && !thread->killed) while (spider_init_queries[i].length && !thd->killed && !thread->killed &&
thread->init_command)
{ {
dispatch_command(COM_QUERY, thd, spider_init_queries[i].str, dispatch_command(COM_QUERY, thd, spider_init_queries[i].str,
(uint) spider_init_queries[i].length, FALSE, FALSE); (uint) spider_init_queries[i].length, FALSE, FALSE);
......
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