Skip to content
Permalink
Browse files

MDEV-20179 Server hangs on shutdown during installation of Spider (#…

  • Loading branch information...
Kentoku committed Jul 29, 2019
1 parent 7221b9e commit 6dfa085fd5cfa9f4edd91b2a02ebeb8bd71d4966
Showing with 23 additions and 11 deletions.
  1. +1 −0 storage/spider/spd_include.h
  2. +3 −2 storage/spider/spd_malloc.h
  3. +19 −9 storage/spider/spd_table.cc
@@ -293,6 +293,7 @@ typedef struct st_spider_thread
volatile bool thd_wait;
volatile bool first_free_wait;
volatile bool init_command;
volatile int error;
pthread_t thread;
pthread_cond_t cond;
pthread_mutex_t mutex;
@@ -1,4 +1,5 @@
/* Copyright (C) 2012-2014 Kentoku Shiba
/* Copyright (C) 2012-2019 Kentoku Shiba
Copyright (C) 2019 MariaDB corp
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -19,7 +20,7 @@
#define spider_bulk_malloc(A,B,C,...) \
spider_bulk_alloc_mem(A,B,__func__,__FILE__,__LINE__,C,__VA_ARGS__)
#define spider_current_trx \
(current_thd ? ((SPIDER_TRX *) thd_get_ha_data(current_thd, spider_hton_ptr)) : NULL)
(current_thd && spider_hton_ptr->slot != HA_SLOT_UNDEF ? ((SPIDER_TRX *) thd_get_ha_data(current_thd, spider_hton_ptr)) : NULL)

#define init_calc_mem(A) init_mem_calc(A,__func__,__FILE__,__LINE__)

@@ -7380,10 +7380,16 @@ int spider_db_init(
DBUG_PRINT("info",("spider before releasing mutex"));
pthread_mutex_unlock(&spider_table_sts_threads[0].mutex);
DBUG_PRINT("info",("spider after releasing mutex"));
if (spider_table_sts_threads[0].error)
{
error_num = spider_table_sts_threads[0].error;
goto error_init_sql;
}
#endif
DBUG_RETURN(0);

#ifndef WITHOUT_SPIDER_BG_SEARCH
error_init_sql:
error_init_dbton:
for (roop_count--; roop_count >= 0; roop_count--)
{
@@ -10033,7 +10039,8 @@ void *spider_table_bg_sts_action(
(uint) spider_init_queries[i].length, FALSE, FALSE);
if (unlikely(thd->is_error()))
{
fprintf(stderr, "[ERROR] %s\n", thd->get_stmt_da()->message());
thread->error = spider_stmt_da_sql_errno(thd);
fprintf(stderr, "[ERROR] %s\n", spider_stmt_da_message(thd));
thd->clear_error();
break;
}
@@ -10057,17 +10064,20 @@ void *spider_table_bg_sts_action(
pthread_cond_wait(&thread->cond, &thread->mutex);
thread->thd_wait = FALSE;
}
while (spider_init_queries[i].length && !thd->killed)
if (likely(!thread->error))
{
dispatch_command(COM_QUERY, thd, spider_init_queries[i].str,
(uint) spider_init_queries[i].length, FALSE, FALSE);
if (unlikely(thd->is_error()))
while (spider_init_queries[i].length && !thd->killed)
{
fprintf(stderr, "[ERROR] %s\n", thd->get_stmt_da()->message());
thd->clear_error();
break;
dispatch_command(COM_QUERY, thd, spider_init_queries[i].str,
(uint) spider_init_queries[i].length, FALSE, FALSE);
if (unlikely(thd->is_error()))
{
fprintf(stderr, "[ERROR] %s\n", spider_stmt_da_message(thd));
thd->clear_error();
break;
}
++i;
}
++i;
}
thd->mysys_var->current_cond = &thread->cond;
thd->mysys_var->current_mutex = &thread->mutex;

0 comments on commit 6dfa085

Please sign in to comment.
You can’t perform that action at this time.