Commit c93754d4 authored by Marko Mäkelä's avatar Marko Mäkelä Committed by Sergei Golubchik

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
parent a42a6fa9
...@@ -378,7 +378,7 @@ static void trx_purge_free_segment(buf_block_t *block, mtr_t &mtr) ...@@ -378,7 +378,7 @@ static void trx_purge_free_segment(buf_block_t *block, mtr_t &mtr)
block->page.frame, &mtr)) block->page.frame, &mtr))
{ {
block->fix(); block->fix();
const page_id_t id{block->page.id()}; ut_d(const page_id_t id{block->page.id()});
mtr.commit(); mtr.commit();
/* NOTE: If the server is killed after the log that was produced /* NOTE: If the server is killed after the log that was produced
up to this point was written, and before the log from the mtr.commit() up to this point was written, and before the log from the mtr.commit()
...@@ -390,15 +390,7 @@ static void trx_purge_free_segment(buf_block_t *block, mtr_t &mtr) ...@@ -390,15 +390,7 @@ static void trx_purge_free_segment(buf_block_t *block, mtr_t &mtr)
log_free_check(); log_free_check();
mtr.start(); mtr.start();
block->page.lock.x_lock(); block->page.lock.x_lock();
if (UNIV_UNLIKELY(block->page.id() != id)) ut_ad(block->page.id() == id);
{
block->unfix();
block->page.lock.x_unlock();
block= buf_page_get_gen(id, 0, RW_X_LATCH, nullptr, BUF_GET, &mtr);
if (!block)
return;
}
else
mtr.memo_push(block, MTR_MEMO_PAGE_X_MODIFY); mtr.memo_push(block, MTR_MEMO_PAGE_X_MODIFY);
} }
...@@ -422,7 +414,6 @@ trx_purge_truncate_rseg_history(trx_rseg_t &rseg, ...@@ -422,7 +414,6 @@ trx_purge_truncate_rseg_history(trx_rseg_t &rseg,
mtr.start(); mtr.start();
dberr_t err; dberr_t err;
reget:
buf_block_t *rseg_hdr= rseg.get(&mtr, &err); buf_block_t *rseg_hdr= rseg.get(&mtr, &err);
if (!rseg_hdr) if (!rseg_hdr)
{ {
...@@ -524,12 +515,7 @@ trx_purge_truncate_rseg_history(trx_rseg_t &rseg, ...@@ -524,12 +515,7 @@ trx_purge_truncate_rseg_history(trx_rseg_t &rseg,
log_free_check(); log_free_check();
mtr.start(); mtr.start();
rseg_hdr->page.lock.x_lock(); rseg_hdr->page.lock.x_lock();
if (UNIV_UNLIKELY(rseg_hdr->page.id() != rseg.page_id())) ut_ad(rseg_hdr->page.id() == rseg.page_id());
{
rseg_hdr->unfix();
rseg_hdr->page.lock.x_unlock();
goto reget;
}
mtr.memo_push(rseg_hdr, MTR_MEMO_PAGE_X_MODIFY); mtr.memo_push(rseg_hdr, MTR_MEMO_PAGE_X_MODIFY);
goto loop; goto loop;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment