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
parent 0ea625b3
...@@ -2447,10 +2447,6 @@ DECLARE_THREAD(srv_master_thread)( ...@@ -2447,10 +2447,6 @@ DECLARE_THREAD(srv_master_thread)(
ut_a(slot == srv_sys.sys_threads); ut_a(slot == srv_sys.sys_threads);
loop: loop:
if (srv_force_recovery >= SRV_FORCE_NO_BACKGROUND) {
goto suspend_thread;
}
while (srv_shutdown_state == SRV_SHUTDOWN_NONE) { while (srv_shutdown_state == SRV_SHUTDOWN_NONE) {
srv_master_sleep(); srv_master_sleep();
...@@ -2465,7 +2461,6 @@ DECLARE_THREAD(srv_master_thread)( ...@@ -2465,7 +2461,6 @@ DECLARE_THREAD(srv_master_thread)(
} }
} }
suspend_thread:
switch (srv_shutdown_state) { switch (srv_shutdown_state) {
case SRV_SHUTDOWN_NONE: case SRV_SHUTDOWN_NONE:
break; break;
......
...@@ -2642,7 +2642,8 @@ innobase_start_or_create_for_mysql() ...@@ -2642,7 +2642,8 @@ innobase_start_or_create_for_mysql()
/* Create the master thread which does purge and other utility /* Create the master thread which does purge and other utility
operations */ 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( thread_handles[1 + SRV_MAX_N_IO_THREADS] = os_thread_create(
srv_master_thread, srv_master_thread,
NULL, thread_ids + (1 + SRV_MAX_N_IO_THREADS)); NULL, thread_ids + (1 + SRV_MAX_N_IO_THREADS));
......
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