summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKentoku SHIBA <kentokushiba@gmail.com>2019-07-29 21:18:51 +0900
committerGitHub <noreply@github.com>2019-07-29 21:18:51 +0900
commit83d368a062f017bd28536639cb2041a6f2b88d55 (patch)
tree4a90be13cc67a5c82a114b29b8c01e7b8f2cbb6b
parent67177cd2c8fe2161af48462dc644299af337c182 (diff)
downloadmariadb-git-83d368a062f017bd28536639cb2041a6f2b88d55.tar.gz
MDEV-20179 Server hangs on shutdown during installation of Spider (#1366)
-rw-r--r--storage/spider/spd_table.cc19
1 files changed, 13 insertions, 6 deletions
diff --git a/storage/spider/spd_table.cc b/storage/spider/spd_table.cc
index 33573fd7fd3..ebc784608e3 100644
--- a/storage/spider/spd_table.cc
+++ b/storage/spider/spd_table.cc
@@ -10027,7 +10027,7 @@ void *spider_table_bg_sts_action(
tmp_disable_binlog(thd);
thd->security_ctx->skip_grants();
thd->client_capabilities |= CLIENT_MULTI_RESULTS;
- while (spider_init_queries[i + 2].length)
+ while (spider_init_queries[i + 2].length && !thd->killed)
{
dispatch_command(COM_QUERY, thd, spider_init_queries[i].str,
(uint) spider_init_queries[i].length, FALSE, FALSE);
@@ -10041,7 +10041,7 @@ void *spider_table_bg_sts_action(
}
DBUG_PRINT("info",("spider first_free_wait=%s",
thread->first_free_wait ? "TRUE" : "FALSE"));
- if (!thread->first_free_wait)
+ if (!thread->first_free_wait && !thd->killed)
{
thread->thd_wait = TRUE;
pthread_cond_wait(&thread->cond, &thread->mutex);
@@ -10049,10 +10049,13 @@ void *spider_table_bg_sts_action(
}
DBUG_ASSERT(thread->first_free_wait);
pthread_cond_signal(&thread->sync_cond);
- thread->thd_wait = TRUE;
- pthread_cond_wait(&thread->cond, &thread->mutex);
- thread->thd_wait = FALSE;
- while (spider_init_queries[i].length)
+ if (!thd->killed)
+ {
+ thread->thd_wait = TRUE;
+ pthread_cond_wait(&thread->cond, &thread->mutex);
+ thread->thd_wait = FALSE;
+ }
+ while (spider_init_queries[i].length && !thd->killed)
{
dispatch_command(COM_QUERY, thd, spider_init_queries[i].str,
(uint) spider_init_queries[i].length, FALSE, FALSE);
@@ -10068,6 +10071,10 @@ void *spider_table_bg_sts_action(
reenable_binlog(thd);
thread->init_command = FALSE;
}
+ if (thd->killed)
+ {
+ thread->killed = TRUE;
+ }
while (TRUE)
{