Skip to content

Commit 21bb6a3

Browse files
committed
MDEV-37447: Race condition between buf_pool_t::shrink() and page_guess()
buf_pool_t::shrink(): When relocating a buffer page, invalidate the page identifier of the original page so that buf_pool_t::page_guess() will not accidentally match it. Before commit b692342 (MDEV-29445) introduced buf_pool_t::page_guess(), the validity of block descriptor pointers was checked by buf_pool_t::is_uncompressed(const buf_block_t*). Therefore, any block descriptors that used to be part of a larger buffer pool would not be accessed at all. This race condition is very hard to reproduce. To reproduce it, an optimistic btr_pcur_t::restore_position() or similar will have to be invoked on a block that has been relocated by buf_pool_t::shrink() and that had not meanwhile been replaced with another page with a different identifier. Reviewed by: Vladislav Lesin
1 parent b489d5f commit 21bb6a3

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

storage/innobase/buf/buf0buf.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1781,6 +1781,7 @@ ATTRIBUTE_COLD buf_pool_t::shrink_status buf_pool_t::shrink(size_t size)
17811781
/* relocate page_hash */
17821782
ut_ad(b == page_hash.get(id, chain));
17831783
page_hash.replace(chain, b, &block->page);
1784+
b->id_.set_corrupted();
17841785

17851786
if (b->zip.data)
17861787
{

0 commit comments

Comments
 (0)