MDEV-33009 Server hangs for a long time with innodb_undo_log_truncate=ON

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 a0f02f743848fb6ef6d2a51960f77e1e38da1682 (MDEV-32757).

Tested by: Axel Schwenke
Reviewed by: Vladislav Lesin
This commit is contained in:
Marko Mäkelä 2023-12-15 15:38:31 +02:00
parent 2c60d43d7d
commit f98d2ef5b4

View File

@ -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;