Commit 744e9752 authored by Vlad Lesin's avatar Vlad Lesin

MDEV-24705 add check that LSN of the last skipped log record equals to FIL_PAGE_LSN field

The check is added.
parent 6e80a34d
...@@ -2268,12 +2268,13 @@ static void recv_recover_page(buf_block_t* block, mtr_t& mtr, ...@@ -2268,12 +2268,13 @@ static void recv_recover_page(buf_block_t* block, mtr_t& mtr,
ut_d(lsn_t recv_start_lsn = 0); ut_d(lsn_t recv_start_lsn = 0);
const lsn_t init_lsn = init ? init->lsn : 0; const lsn_t init_lsn = init ? init->lsn : 0;
bool skipped_after_init = false;
for (const log_rec_t* recv : p->second.log) { for (const log_rec_t* recv : p->second.log) {
const log_phys_t* l = static_cast<const log_phys_t*>(recv); const log_phys_t* l = static_cast<const log_phys_t*>(recv);
ut_ad(l->lsn); ut_ad(l->lsn);
ut_ad(end_lsn <= l->lsn); ut_ad(end_lsn <= l->lsn);
end_lsn = l->lsn; ut_ad(l->lsn <= log_sys.log.scanned_lsn);
ut_ad(end_lsn <= log_sys.log.scanned_lsn);
ut_ad(l->start_lsn); ut_ad(l->start_lsn);
ut_ad(recv_start_lsn <= l->start_lsn); ut_ad(recv_start_lsn <= l->start_lsn);
...@@ -2286,6 +2287,8 @@ static void recv_recover_page(buf_block_t* block, mtr_t& mtr, ...@@ -2286,6 +2287,8 @@ static void recv_recover_page(buf_block_t* block, mtr_t& mtr,
block->page.id().space(), block->page.id().space(),
block->page.id().page_no(), block->page.id().page_no(),
l->start_lsn, page_lsn)); l->start_lsn, page_lsn));
skipped_after_init = true;
end_lsn = l->lsn;
continue; continue;
} }
...@@ -2295,9 +2298,24 @@ static void recv_recover_page(buf_block_t* block, mtr_t& mtr, ...@@ -2295,9 +2298,24 @@ static void recv_recover_page(buf_block_t* block, mtr_t& mtr,
block->page.id().space(), block->page.id().space(),
block->page.id().page_no(), block->page.id().page_no(),
l->start_lsn, init_lsn)); l->start_lsn, init_lsn));
skipped_after_init = false;
end_lsn = l->lsn;
continue; continue;
} }
/* There is no need to check LSN for just initialized pages. */
if (skipped_after_init) {
skipped_after_init = false;
ut_ad(end_lsn == page_lsn);
if (end_lsn != page_lsn)
ib::warn()
<< "The last skipped log record LSN "
<< end_lsn
<< " is not equal to page LSN "
<< page_lsn;
}
end_lsn = l->lsn;
if (UNIV_UNLIKELY(srv_print_verbose_log == 2)) { if (UNIV_UNLIKELY(srv_print_verbose_log == 2)) {
ib::info() << "apply " << l->start_lsn ib::info() << "apply " << l->start_lsn
......
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