Skip to content

Commit c26eae0

Browse files
committed
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.
1 parent b1009ae commit c26eae0

File tree

1 file changed

+8
-17
lines changed

1 file changed

+8
-17
lines changed

storage/innobase/mtr/mtr0mtr.cc

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -313,25 +313,17 @@ mini-transaction */
313313
struct FindBlock
314314
{
315315
int32_t num_fix;
316-
buf_block_t *block;
316+
const buf_block_t *const block;
317+
318+
FindBlock(const buf_block_t *block_buf): num_fix(0), block(block_buf) {}
317319

318-
FindBlock(buf_block_t *block_buf): num_fix(0), block(block_buf) {}
319320
bool operator()(const mtr_memo_slot_t* slot)
320321
{
321-
if (slot->object != NULL)
322-
{
323-
buf_block_t *mtr_block= reinterpret_cast<buf_block_t*>(slot->object);
324-
if (mtr_block == block)
325-
num_fix++;
326-
}
327-
322+
if (slot->object == block)
323+
ut_d(if (slot->type != MTR_MEMO_MODIFY))
324+
num_fix++;
328325
return true;
329326
}
330-
331-
int32_t get_num_fix()
332-
{
333-
return num_fix;
334-
}
335327
};
336328

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

833825
int32_t mtr_t::get_fix_count(buf_block_t *block)
834826
{
835-
struct FindBlock find_block(block);
836-
Iterate<FindBlock> iteration(find_block);
827+
Iterate<FindBlock> iteration((FindBlock(block)));
837828
if (m_memo.for_each_block(iteration))
838-
return iteration.functor.get_num_fix();
829+
return iteration.functor.num_fix;
839830
return 0;
840831
}
841832

0 commit comments

Comments
 (0)