mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
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
This commit is contained in:
@ -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 @@ loop:
|
||||
|
||||
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 @@ loop:
|
||||
|
||||
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 @@ loop:
|
||||
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 @@ loop:
|
||||
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();
|
||||
|
||||
|
Reference in New Issue
Block a user