diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc index 2aea7b8ccb3..fbe29d5e75f 100644 --- a/storage/innobase/srv/srv0start.cc +++ b/storage/innobase/srv/srv0start.cc @@ -2602,13 +2602,15 @@ files_checked: operations */ if (!srv_read_only_mode) { - thread_handles[1 + SRV_MAX_N_IO_THREADS] = os_thread_create( srv_master_thread, NULL, thread_ids + (1 + SRV_MAX_N_IO_THREADS)); thread_started[1 + SRV_MAX_N_IO_THREADS] = true; srv_start_state_set(SRV_START_STATE_MASTER); + } + if (!srv_read_only_mode + && srv_force_recovery < SRV_FORCE_NO_BACKGROUND) { srv_undo_sources = true; /* Create the dict stats gathering thread */ srv_dict_stats_thread_active = true; @@ -2617,10 +2619,6 @@ files_checked: /* Create the thread that will optimize the FTS sub-system. */ fts_optimize_init(); - } - - if (!srv_read_only_mode - && srv_force_recovery < SRV_FORCE_NO_BACKGROUND) { thread_handles[5 + SRV_MAX_N_IO_THREADS] = os_thread_create( srv_purge_coordinator_thread, diff --git a/storage/innobase/trx/trx0purge.cc b/storage/innobase/trx/trx0purge.cc index e317a38815b..5fea72b870c 100644 --- a/storage/innobase/trx/trx0purge.cc +++ b/storage/innobase/trx/trx0purge.cc @@ -285,6 +285,8 @@ trx_purge_add_update_undo_to_history( purge have been started, recv_recovery_rollback_active() can start transactions in row_merge_drop_temp_indexes() and fts_drop_orphaned_tables(), and roll back recovered transactions. + Also, DROP TABLE may be executed while innodb_force_recovery=2 + prevents the purge from running. After the purge thread has been given permission to exit, in fast shutdown, we may roll back transactions (trx->undo_no==0) in THD::cleanup() invoked from unlink_thd(). */ @@ -292,6 +294,8 @@ trx_purge_add_update_undo_to_history( || ((srv_startup_is_before_trx_rollback_phase || trx_rollback_or_clean_is_active) && purge_sys->state == PURGE_STATE_INIT) + || (srv_force_recovery >= SRV_FORCE_NO_BACKGROUND + && purge_sys->state == PURGE_STATE_DISABLED) || (trx->undo_no == 0 && srv_fast_shutdown)); /* Add the log as the first in the history list */