From 476ff0927ac4487b9c5ea64916b94f2bb5246dff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 19 Dec 2023 14:45:39 +0200 Subject: [PATCH] MDEV-33062 innodb_undo_log_truncate=ON prevents fast shutdown trx_purge_truncate_history(): If a fast shutdown has been initiated, disregard innodb_undo_log_truncate=ON and return. --- storage/innobase/trx/trx0purge.cc | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/storage/innobase/trx/trx0purge.cc b/storage/innobase/trx/trx0purge.cc index 702e76fc284..a7e3e7367b1 100644 --- a/storage/innobase/trx/trx0purge.cc +++ b/storage/innobase/trx/trx0purge.cc @@ -645,6 +645,16 @@ void trx_purge_truncate_history() mini-transaction commit and the server was killed, then discarding the to-be-trimmed pages without flushing would break crash recovery. */ + + rescan: + if (UNIV_UNLIKELY(srv_shutdown_state != SRV_SHUTDOWN_NONE) && + srv_fast_shutdown) + { + fast_shutdown: + mtr.commit(); + return; + } + mysql_mutex_lock(&buf_pool.flush_list_mutex); for (buf_page_t *bpage= UT_LIST_GET_LAST(buf_pool.flush_list); bpage; ) @@ -687,10 +697,7 @@ void trx_purge_truncate_history() buf_pool.flush_list_mutex. Ensure that they can proceed, to avoid extreme waits. */ mysql_mutex_unlock(&buf_pool.flush_list_mutex); - mysql_mutex_lock(&buf_pool.flush_list_mutex); - /* Rescan, because we may have lost the position. */ - bpage= UT_LIST_GET_LAST(buf_pool.flush_list); - continue; + goto rescan; } } @@ -699,6 +706,10 @@ void trx_purge_truncate_history() mysql_mutex_unlock(&buf_pool.flush_list_mutex); + if (UNIV_UNLIKELY(srv_shutdown_state != SRV_SHUTDOWN_NONE) && + srv_fast_shutdown) + goto fast_shutdown; + /* Adjust the tablespace metadata. */ if (!fil_truncate_prepare(space.id)) {