summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--storage/innobase/trx/trx0purge.cc18
1 files changed, 12 insertions, 6 deletions
diff --git a/storage/innobase/trx/trx0purge.cc b/storage/innobase/trx/trx0purge.cc
index fe62593a313..657a1e3a2d4 100644
--- a/storage/innobase/trx/trx0purge.cc
+++ b/storage/innobase/trx/trx0purge.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2021, MariaDB Corporation.
+Copyright (c) 2017, 2022, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -705,7 +705,16 @@ not_free:
{
auto block= reinterpret_cast<buf_block_t*>(bpage);
ut_ad(buf_pool.is_uncompressed(block));
- bpage->lock.x_lock();
+ if (!bpage->lock.x_lock_try())
+ {
+ /* 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.flush_list_mutex);
+ rescan:
+ bpage= UT_LIST_GET_LAST(buf_pool.flush_list);
+ continue;
+ }
buf_pool.flush_hp.set(prev);
mysql_mutex_unlock(&buf_pool.flush_list_mutex);
@@ -728,11 +737,8 @@ not_free:
}
if (prev != buf_pool.flush_hp.get())
- {
/* Rescan, because we may have lost the position. */
- bpage= UT_LIST_GET_LAST(buf_pool.flush_list);
- continue;
- }
+ goto rescan;
}
bpage= prev;