Skip to content

Commit

Permalink
Fix galera.galera_kill_ddl test errors in debug mode.
Browse files Browse the repository at this point in the history
Marko reported DBUG_ASSERT from dict_stats_shutdown().

destroy_background_thd() does not like when current_thd is set.
In galera, it can be the case, dict_stats_shutdown() can be called from
user thread, to stop and later restart stats recalculations.
  • Loading branch information
vaintroub committed Dec 22, 2023
1 parent bdaa6ba commit 9f40f02
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions storage/innobase/dict/dict0stats_bg.cc
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ static recalc_pool_t recalc_pool;
/** Whether the global data structures have been initialized */
static bool stats_initialised;

static THD *dict_stats_thd;

/*****************************************************************//**
Free the resources occupied by the recalc pool, called once during
thread de-initialization. */
Expand All @@ -90,6 +92,9 @@ static void dict_stats_recalc_pool_deinit()
defrag_pool_t defrag_empty_pool;
recalc_pool.swap(recalc_empty_pool);
defrag_pool.swap(defrag_empty_pool);

if (dict_stats_thd)
destroy_background_thd(dict_stats_thd);
}

/*****************************************************************//**
Expand Down Expand Up @@ -379,7 +384,6 @@ static bool is_recalc_pool_empty()
}

static tpool::timer* dict_stats_timer;
static THD *dict_stats_thd;
static void dict_stats_func(void*)
{
if (!dict_stats_thd)
Expand Down Expand Up @@ -419,10 +423,4 @@ void dict_stats_shutdown()
{
delete dict_stats_timer;
dict_stats_timer= 0;

if (dict_stats_thd)
{
destroy_background_thd(dict_stats_thd);
dict_stats_thd= 0;
}
}

0 comments on commit 9f40f02

Please sign in to comment.