MDEV-37192 Crash recovery reports corrupiton after bulk load

Problem:
=======
- InnoDB modifies the PAGE_ROOT_AUTO_INC value on clustered index
root page. But before committing the PAGE_ROOT_AUTO_INC changes
mini-transaction, InnoDB does bulk insert operation and
calculates the page checksum and store as a part of redo log in
mini-transaction. During recovery, InnoDB fails to validate the
page checksum.

Solution:
========
- Avoid writing the persistent auto increment value before doing
bulk insert operation.

- For bulk insert operation, persistent auto increment value
is written via btr_write_autoinc while applying the buffered
insert operation.
This commit is contained in:
Thirunarayanan Balathandayuthapani 2025-08-06 14:29:58 +05:30 committed by Thirunarayanan B
commit 05f9fd3dd2
3 changed files with 33 additions and 7 deletions

View file

@ -2729,13 +2729,6 @@ err_exit:
goto func_exit;
}
if (auto_inc) {
buf_block_t* root
= mtr.at_savepoint(mode != BTR_MODIFY_ROOT_AND_LEAF);
ut_ad(index->page == root->page.id().page_no());
page_set_autoinc(root, auto_inc, &mtr, false);
}
btr_pcur_get_btr_cur(&pcur)->thr = thr;
#ifdef UNIV_DEBUG
@ -2854,6 +2847,13 @@ avoid_bulk:
}
row_level_insert:
if (auto_inc) {
buf_block_t* root =
mtr.at_savepoint(mode != BTR_MODIFY_ROOT_AND_LEAF);
ut_ad(index->page == root->page.id().page_no());
page_set_autoinc(root, auto_inc, &mtr, false);
}
if (UNIV_UNLIKELY(entry->info_bits != 0)) {
const rec_t* rec = btr_pcur_get_rec(&pcur);