Skip to content
Permalink
Browse files
MDEV-30180 Server hang with innodb_undo_log_truncate=ON
trx_purge_truncate_history(): In case of an apparent conflict with
buf_pool_t::release_freed_page(), always momentarily acquire
buf_pool.mutex, to let the thread that is holding it and waiting for
buf_pool.flush_list_mutex to proceed.

The fix in commit c410f7a was
insufficient, because simple yielding would not necessarily let
the conflicting thread to acquire buf_pool.flush_list_mutex.

This hang was reported and the fix tested by Axel Schwenke.
  • Loading branch information
dr-m committed Dec 12, 2022
1 parent dd5f4b3 commit c4d7939
Showing 1 changed file with 3 additions and 2 deletions.
@@ -766,11 +766,12 @@ TRANSACTIONAL_TARGET static void trx_purge_truncate_history()
auto block= reinterpret_cast<buf_block_t*>(bpage);
if (!bpage->lock.x_lock_try())
{
rescan:
/* Let buf_pool_t::release_freed_page() proceed. */
mysql_mutex_unlock(&buf_pool.flush_list_mutex);
std::this_thread::yield();
mysql_mutex_lock(&buf_pool.mutex);
mysql_mutex_lock(&buf_pool.flush_list_mutex);
rescan:
mysql_mutex_unlock(&buf_pool.mutex);
bpage= UT_LIST_GET_LAST(buf_pool.flush_list);
continue;
}

0 comments on commit c4d7939

Please sign in to comment.