Commit 325e6aa7 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-28879 Assertion `l->lsn <= log_sys.get_lsn()' failed around recv_recover_page

recv_recover_page(): Correct a debug assertion to refer to recv_sys.lsn,
which may be ahead of log_sys.lsn during non-final recovery batches.
In commit 685d958e (MDEV-14425)
when some redundant LSN fields were removed,
log_sys.log.scanned_lsn had been replaced with a reference to
log_sys.lsn instead of the more appropriate recv_sys.lsn.

recv_scan_log(): Remove a redundant call to log_sys.set_recovered_lsn().
It suffices to adjust the log_sys.lsn after parsing (and before starting
to apply) records for the last batch.

Note: Normally, log_sys.lsn must be the latest log sequence number.
Before the final recovery batch, this may be safely violated, because
log_write_up_to() will be a no-op. That function will be invoked by the
buf_flush_page_cleaner thread to initiate writes of recovered pages.
parent cb19e211
...@@ -2918,7 +2918,7 @@ static buf_block_t *recv_recover_page(buf_block_t *block, mtr_t &mtr, ...@@ -2918,7 +2918,7 @@ static buf_block_t *recv_recover_page(buf_block_t *block, mtr_t &mtr,
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);
ut_ad(l->lsn <= log_sys.get_lsn()); ut_ad(l->lsn <= recv_sys.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);
...@@ -3561,13 +3561,11 @@ void recv_sys_t::apply(bool last_batch) ...@@ -3561,13 +3561,11 @@ void recv_sys_t::apply(bool last_batch)
if (last_batch && srv_operation != SRV_OPERATION_RESTORE && if (last_batch && srv_operation != SRV_OPERATION_RESTORE &&
srv_operation != SRV_OPERATION_RESTORE_EXPORT) srv_operation != SRV_OPERATION_RESTORE_EXPORT)
/* Instead of flushing, last_batch sorts the buf_pool.flush_list
in ascending order of buf_page_t::oldest_modification. */
log_sort_flush_list(); log_sort_flush_list();
else else
{
/* Instead of flushing, last_batch could sort the buf_pool.flush_list
in ascending order of buf_page_t::oldest_modification. */
buf_flush_sync_batch(lsn); buf_flush_sync_batch(lsn);
}
if (!last_batch) if (!last_batch)
{ {
...@@ -3738,7 +3736,6 @@ static bool recv_scan_log(bool last_phase) ...@@ -3738,7 +3736,6 @@ static bool recv_scan_log(bool last_phase)
else else
{ {
ut_ad(store == STORE_IF_EXISTS); ut_ad(store == STORE_IF_EXISTS);
log_sys.set_recovered_lsn(recv_sys.lsn);
recv_sys.apply(false); recv_sys.apply(false);
} }
} }
......
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