MDEV-18966 Transaction recovery may be broken after upgrade to 10.3
This bug was introduced by MDEV-12288, which made InnoDB use a single undo log for persistent transactions, instead of maintaining separate insert_undo and update_undo logs. trx_undo_reuse_cached(): Initialize the TRX_UNDO_PAGE_TYPE after reusing a cached undo log page for undo log. Failure to do so can cause trx_undo_mem_create_at_db_start() to misclassify new undo log records as TRX_UNDO_INSERT. This in turn would trigger an assertion failure in trx_roll_pop_top_rec_of_trx() due to undo==insert.
This commit is contained in:
parent
6893e9940a
commit
cdb2208cd6
@ -1352,6 +1352,15 @@ trx_undo_reuse_cached(trx_t* trx, trx_rseg_t* rseg, trx_undo_t** pundo,
|
||||
*pundo = undo;
|
||||
|
||||
ulint offset = trx_undo_header_create(block->frame, trx->id, mtr);
|
||||
/* Reset the TRX_UNDO_PAGE_TYPE in case this page is being
|
||||
repurposed after upgrading to MariaDB 10.3. */
|
||||
if (ut_d(ulint type =) UNIV_UNLIKELY(
|
||||
mach_read_from_2(TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_TYPE
|
||||
+ block->frame))) {
|
||||
ut_ad(type == TRX_UNDO_INSERT || type == TRX_UNDO_UPDATE);
|
||||
mlog_write_ulint(TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_TYPE
|
||||
+ block->frame, 0, MLOG_2BYTES, mtr);
|
||||
}
|
||||
|
||||
trx_undo_header_add_space_for_xid(block->frame, block->frame + offset,
|
||||
mtr);
|
||||
|
Loading…
x
Reference in New Issue
Block a user