Skip to content

Commit

Permalink
MDEV-33009 Server hangs for a long time with innodb_undo_log_truncate=ON
Browse files Browse the repository at this point in the history
trx_purge_truncate_history(): Release buf_pool.flush_list_mutex
before starting a rescan of buf_pool.flush_list, to ensure that
the buf_flush_page_cleaner thread (which may be holding buf_pool.mutex)
will be able to proceed.

This fixes up commit a0f02f7 (MDEV-32757).

Tested by: Axel Schwenke
Reviewed by: Vladislav Lesin
  • Loading branch information
dr-m committed Dec 15, 2023
1 parent 2c60d43 commit f98d2ef
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions storage/innobase/trx/trx0purge.cc
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,13 @@ void trx_purge_truncate_history()

if (prev != buf_pool.flush_hp.get())
{
/* The functions buf_pool_t::release_freed_page() or
buf_do_flush_list_batch() may be right now holding
buf_pool.mutex and waiting to acquire
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;
Expand Down

0 comments on commit f98d2ef

Please sign in to comment.