diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2019-03-19 11:09:53 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2019-03-19 11:09:53 +0200 |
commit | cdb2208cd64d1ad4e6a902ab84591c4f3fff0f1c (patch) | |
tree | 7b9118ad03f34bf3e25f0939830ffcacb9709c87 /storage/innobase/trx/trx0undo.cc | |
parent | 6893e9940a49f92d879591116fa3390f0aa10eba (diff) | |
download | mariadb-git-cdb2208cd64d1ad4e6a902ab84591c4f3fff0f1c.tar.gz |
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.
Diffstat (limited to 'storage/innobase/trx/trx0undo.cc')
-rw-r--r-- | storage/innobase/trx/trx0undo.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/storage/innobase/trx/trx0undo.cc b/storage/innobase/trx/trx0undo.cc index 61ba65ebc19..354d3c8d848 100644 --- a/storage/innobase/trx/trx0undo.cc +++ b/storage/innobase/trx/trx0undo.cc @@ -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); |