Skip to content

Commit

Permalink
MDEV-33062 innodb_undo_log_truncate=ON prevents fast shutdown
Browse files Browse the repository at this point in the history
trx_purge_truncate_history(): If a fast shutdown has been initiated,
disregard innodb_undo_log_truncate=ON and return.
  • Loading branch information
dr-m committed Dec 19, 2023
1 parent 4c2e971 commit 476ff09
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions storage/innobase/trx/trx0purge.cc
Expand Up @@ -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; )
Expand Down Expand Up @@ -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;
}
}

Expand All @@ -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))
{
Expand Down

0 comments on commit 476ff09

Please sign in to comment.