Commit c7fc8045 authored by Sunny Bains's avatar Sunny Bains

Fix bug#53499 - purge thread is active during shutdown, assert buf/buf0buf.c line 4115.

Check that all background threads are suspended or shutdown instead of just
checking for the master thread.
rb://333
parent 053d75ea
......@@ -639,12 +639,12 @@ srv_que_task_enqueue_low(
que_thr_t* thr); /*!< in: query thread */
/**********************************************************************//**
Check whether the master thread is active.
@return FALSE is it is not active. */
Check whether any background thread is active.
@return FALSE if all are are suspended or have exited. */
UNIV_INTERN
ibool
srv_is_master_thread_active(void);
/*==============================*/
srv_is_any_background_thread_active(void);
/*======================================*/
/** Status variables to be passed to MySQL */
struct export_var_struct{
......
......@@ -3133,9 +3133,9 @@ logs_empty_and_mark_files_at_shutdown(void)
mutex_exit(&kernel_mutex);
/* Check that the master thread is suspended */
/* Check that the background threads are suspended */
if (srv_is_master_thread_active()) {
if (srv_is_any_background_thread_active()) {
goto loop;
}
......@@ -3196,10 +3196,10 @@ logs_empty_and_mark_files_at_shutdown(void)
mutex_exit(&(log_sys->mutex));
/* Check that the master thread has stayed suspended */
if (srv_is_master_thread_active()) {
/* Check that the background threads stay suspended */
if (srv_is_any_background_thread_active()) {
fprintf(stderr,
"InnoDB: Warning: the master thread woke up"
"InnoDB: Warning: some background thread woke up"
" during shutdown\n");
goto loop;
......@@ -3221,7 +3221,7 @@ logs_empty_and_mark_files_at_shutdown(void)
srv_shutdown_state = SRV_SHUTDOWN_LAST_PHASE;
/* Make some checks that the server really is quiet */
ut_a(!srv_is_master_thread_active());
ut_a(!srv_is_any_background_thread_active());
ut_a(buf_all_freed());
ut_a(lsn == log_sys->lsn);
......@@ -3243,7 +3243,7 @@ logs_empty_and_mark_files_at_shutdown(void)
fil_close_all_files();
/* Make some checks that the server really is quiet */
ut_a(!srv_is_master_thread_active());
ut_a(!srv_is_any_background_thread_active());
ut_a(buf_all_freed());
ut_a(lsn == log_sys->lsn);
......
......@@ -2559,18 +2559,24 @@ srv_inc_activity_count(void)
}
/**********************************************************************//**
Check whether the master thread is active.
@return FALSE is it is not active. */
Check whether any background thread is active.
@return FALSE if all are are suspended or have exited. */
UNIV_INTERN
ibool
srv_is_master_thread_active(void)
/*=============================*/
srv_is_any_background_thread_active(void)
/*=====================================*/
{
ibool ret;
ulint i;
ibool ret = FALSE;
srv_sys_mutex_enter();
ret = srv_sys->n_threads_active[SRV_MASTER] != 0;
for (i = SRV_COM; i <= SRV_MASTER; ++i) {
if (srv_sys->n_threads_active[i] != 0) {
ret = TRUE;
break;
}
}
srv_sys_mutex_exit();
......
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