Skip to content
Permalink
Browse files
MDEV-23986: fil_page_type_validate() fails on crash recovery
In MDEV-12353, we changed the redo log format so that whenever
any data field is changed, the unchanged prefix of the bytes
will by default be omitted from the redo log record.

However, in order for the MDEV-23199 logic to work, changes of
FSP_SPACE_FLAGS must always be written in full (mtr_t::FORCED),
so that crash recovery can parse them. We must know the flags
in advance, because we might be applying log to other pages than
page 0 first.

recv_scan_log_recs(): Correct a misleading message about starting
crash recovery. Display both the checkpoint LSN and the start
of the records that end in the FILE_CHECKPOINT marker.

Reviewed by: Thirunarayanan Balathandayuthapani
  • Loading branch information
dr-m committed Oct 21, 2020
1 parent 8c074df commit 05cd5ac
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 15 deletions.
@@ -3567,8 +3567,9 @@ void fsp_flags_try_adjust(fil_space_t* space, ulint flags)
<< " to " << ib::hex(flags);
}
mtr.set_named_space(space);
mtr.write<4>(*b, FSP_HEADER_OFFSET + FSP_SPACE_FLAGS
+ b->frame, flags);
mtr.write<4,mtr_t::FORCED>(*b,
FSP_HEADER_OFFSET + FSP_SPACE_FLAGS
+ b->frame, flags);
}
func_exit:
mtr.commit();
@@ -582,10 +582,11 @@ void fsp_header_init(fil_space_t* space, uint32_t size, mtr_t* mtr)
+ block->frame, size);
ut_ad(0 == mach_read_from_4(FSP_HEADER_OFFSET + FSP_FREE_LIMIT
+ block->frame));
mtr->write<4,mtr_t::MAYBE_NOP>(*block,
FSP_HEADER_OFFSET + FSP_SPACE_FLAGS
+ block->frame,
space->flags & ~FSP_FLAGS_MEM_MASK);
if (auto f = space->flags & ~FSP_FLAGS_MEM_MASK) {
mtr->write<4,mtr_t::FORCED>(*block,
FSP_HEADER_OFFSET + FSP_SPACE_FLAGS
+ block->frame, f);
}
ut_ad(0 == mach_read_from_4(FSP_HEADER_OFFSET + FSP_FRAG_N_USED
+ block->frame));

@@ -10316,13 +10316,15 @@ commit_cache_norebuild(
page_id_t(space->id, 0),
space->zip_size(),
RW_X_LATCH, &mtr)) {
mtr.set_named_space(space);
mtr.write<4,mtr_t::MAYBE_NOP>(
*b,
FSP_HEADER_OFFSET
+ FSP_SPACE_FLAGS + b->frame,
space->flags
& ~FSP_FLAGS_MEM_MASK);
byte* f = FSP_HEADER_OFFSET
+ FSP_SPACE_FLAGS + b->frame;
const auto sf = space->flags
& ~FSP_FLAGS_MEM_MASK;
if (mach_read_from_4(f) != sf) {
mtr.set_named_space(space);
mtr.write<4,mtr_t::FORCED>(
*b, f, sf);
}
}
mtr.commit();
}
@@ -2929,8 +2929,8 @@ static bool recv_scan_log_recs(
}

ib::info() << "Starting crash recovery from"
" checkpoint LSN="
<< recv_sys.scanned_lsn;
" checkpoint LSN=" << checkpoint_lsn
<< "," << recv_sys.scanned_lsn;
}

/* We were able to find more log data: add it to the

0 comments on commit 05cd5ac

Please sign in to comment.