Skip to content
Permalink
Browse files
MDEV-23456 fixup: Fix mtr_t::get_fix_count()
Before commit 05fa455 (MDEV-22110)
we have slot->type == MTR_MEMO_MODIFY that are unrelated to
incrementing the buffer-fix count.

FindBlock::operator(): In debug builds, skip MTR_MEMO_MODIFY entries.

Also, simplify the code a little.

This fixes an infinite loop in the tests
innodb.innodb_defragment and innodb.innodb_wl6326_big.
  • Loading branch information
dr-m committed Sep 9, 2020
1 parent b1009ae commit c26eae0
Showing 1 changed file with 8 additions and 17 deletions.
@@ -313,25 +313,17 @@ mini-transaction */
struct FindBlock
{
int32_t num_fix;
buf_block_t *block;
const buf_block_t *const block;

FindBlock(const buf_block_t *block_buf): num_fix(0), block(block_buf) {}

FindBlock(buf_block_t *block_buf): num_fix(0), block(block_buf) {}
bool operator()(const mtr_memo_slot_t* slot)
{
if (slot->object != NULL)
{
buf_block_t *mtr_block= reinterpret_cast<buf_block_t*>(slot->object);
if (mtr_block == block)
num_fix++;
}

if (slot->object == block)
ut_d(if (slot->type != MTR_MEMO_MODIFY))
num_fix++;
return true;
}

int32_t get_num_fix()
{
return num_fix;
}
};

/** Release a resource acquired by the mini-transaction. */
@@ -832,10 +824,9 @@ mtr_t::release_free_extents(ulint n_reserved)

int32_t mtr_t::get_fix_count(buf_block_t *block)
{
struct FindBlock find_block(block);
Iterate<FindBlock> iteration(find_block);
Iterate<FindBlock> iteration((FindBlock(block)));
if (m_memo.for_each_block(iteration))
return iteration.functor.get_num_fix();
return iteration.functor.num_fix;
return 0;
}

0 comments on commit c26eae0

Please sign in to comment.