Skip to content

Commit c93754d

Browse files
dr-mvuvova
authored andcommitted
MDEV-31234 related cleanup
trx_purge_free_segment(), trx_purge_truncate_rseg_history(): Replace some unreachable code with debug assertions. A buffer-fix does prevent pages from being evicted from the buffer pool; see buf_page_t::can_relocate(). Tested by: Matthias Leich
1 parent a42a6fa commit c93754d

File tree

1 file changed

+4
-18
lines changed

1 file changed

+4
-18
lines changed

storage/innobase/trx/trx0purge.cc

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ static void trx_purge_free_segment(buf_block_t *block, mtr_t &mtr)
378378
block->page.frame, &mtr))
379379
{
380380
block->fix();
381-
const page_id_t id{block->page.id()};
381+
ut_d(const page_id_t id{block->page.id()});
382382
mtr.commit();
383383
/* NOTE: If the server is killed after the log that was produced
384384
up to this point was written, and before the log from the mtr.commit()
@@ -390,16 +390,8 @@ static void trx_purge_free_segment(buf_block_t *block, mtr_t &mtr)
390390
log_free_check();
391391
mtr.start();
392392
block->page.lock.x_lock();
393-
if (UNIV_UNLIKELY(block->page.id() != id))
394-
{
395-
block->unfix();
396-
block->page.lock.x_unlock();
397-
block= buf_page_get_gen(id, 0, RW_X_LATCH, nullptr, BUF_GET, &mtr);
398-
if (!block)
399-
return;
400-
}
401-
else
402-
mtr.memo_push(block, MTR_MEMO_PAGE_X_MODIFY);
393+
ut_ad(block->page.id() == id);
394+
mtr.memo_push(block, MTR_MEMO_PAGE_X_MODIFY);
403395
}
404396

405397
while (!fseg_free_step(TRX_UNDO_SEG_HDR + TRX_UNDO_FSEG_HEADER +
@@ -422,7 +414,6 @@ trx_purge_truncate_rseg_history(trx_rseg_t &rseg,
422414
mtr.start();
423415

424416
dberr_t err;
425-
reget:
426417
buf_block_t *rseg_hdr= rseg.get(&mtr, &err);
427418
if (!rseg_hdr)
428419
{
@@ -524,12 +515,7 @@ trx_purge_truncate_rseg_history(trx_rseg_t &rseg,
524515
log_free_check();
525516
mtr.start();
526517
rseg_hdr->page.lock.x_lock();
527-
if (UNIV_UNLIKELY(rseg_hdr->page.id() != rseg.page_id()))
528-
{
529-
rseg_hdr->unfix();
530-
rseg_hdr->page.lock.x_unlock();
531-
goto reget;
532-
}
518+
ut_ad(rseg_hdr->page.id() == rseg.page_id());
533519
mtr.memo_push(rseg_hdr, MTR_MEMO_PAGE_X_MODIFY);
534520

535521
goto loop;

0 commit comments

Comments
 (0)