From fe95cb2e40d73adbbe88efa0e7f48c055ccd042f Mon Sep 17 00:00:00 2001 From: Thirunarayanan Balathandayuthapani Date: Wed, 9 May 2018 19:00:30 +0530 Subject: [PATCH] MDEV-16125 Shutdown crash when innodb_force_recovery >= 2 Problem: ======= InnoDB master thread encounters the shutdown state as SRV_SHUTDOWN_FLUSH_PHASE when innodb_force_recovery >=2 and slow scheduling of master thread during shutdown. Fix: ==== There is no need for master thread itself if innodb_force_recovery >=2. Don't create the master thread if innodb_force_recovery >= 2 --- storage/innobase/srv/srv0srv.cc | 5 ----- storage/innobase/srv/srv0start.cc | 3 ++- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc index 2ad5064b540..81e3b83af05 100644 --- a/storage/innobase/srv/srv0srv.cc +++ b/storage/innobase/srv/srv0srv.cc @@ -2447,10 +2447,6 @@ DECLARE_THREAD(srv_master_thread)( ut_a(slot == srv_sys.sys_threads); loop: - if (srv_force_recovery >= SRV_FORCE_NO_BACKGROUND) { - goto suspend_thread; - } - while (srv_shutdown_state == SRV_SHUTDOWN_NONE) { srv_master_sleep(); @@ -2465,7 +2461,6 @@ loop: } } -suspend_thread: switch (srv_shutdown_state) { case SRV_SHUTDOWN_NONE: break; diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc index 4c043695f1c..98dca77c61d 100644 --- a/storage/innobase/srv/srv0start.cc +++ b/storage/innobase/srv/srv0start.cc @@ -2642,7 +2642,8 @@ files_checked: /* Create the master thread which does purge and other utility operations */ - if (!srv_read_only_mode) { + if (!srv_read_only_mode + && srv_force_recovery < SRV_FORCE_NO_BACKGROUND) { thread_handles[1 + SRV_MAX_N_IO_THREADS] = os_thread_create( srv_master_thread, NULL, thread_ids + (1 + SRV_MAX_N_IO_THREADS));