summaryrefslogtreecommitdiff
path: root/storage/innobase/trx/trx0rseg.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2018-02-21 19:02:32 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2018-02-21 21:49:56 +0200
commitfe0e263e6d9c3330dbc8de4608fc62e8f4700a95 (patch)
tree948912099c5864bb9038baec04760e4d7006f303 /storage/innobase/trx/trx0rseg.cc
parent6a370e4301170b5c26208d81bec849347c45e332 (diff)
downloadmariadb-git-fe0e263e6d9c3330dbc8de4608fc62e8f4700a95.tar.gz
MDEV-15370 Upgrade fails when both insert_undo and update_undo exist
Before MDEV-12288 in MariaDB 10.3.1, InnoDB used to partition the persistent transaction undo log into insert_undo and update_undo. MDEV-12288 repurposes the update_undo as the single undo log. In order to support an upgrade from earlier MariaDB versions, the insert_undo is recovered in data structures, called old_insert. An assertion failure occurred in TrxUndoRsegsIterator::set_next() when an incomplete transaction was recovered with both insert_undo and update_undo log. This could be easily demonstrated by starting ./mysql-test-run --manual-gdb innodb.read_only_recovery in MariaDB 10.2, and after the first kill, start up the MariaDB 10.3 server with the same parameters. The problem is that MariaDB 10.3 would roll back the recovered transaction, and finally "commit" it twice (with all changes to data rolled back), both insert_undo and update_undo with the same commit end identifier (trx->no). Our fix is to introduce a "commit number" that comprises two components: (trx->no << 1 | !old_insert). In this way, the assertion in the purge subsystem can be relaxed so that only the trx->no component must match.
Diffstat (limited to 'storage/innobase/trx/trx0rseg.cc')
-rw-r--r--storage/innobase/trx/trx0rseg.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/storage/innobase/trx/trx0rseg.cc b/storage/innobase/trx/trx0rseg.cc
index 1999db9cbba..73b1f7f7156 100644
--- a/storage/innobase/trx/trx0rseg.cc
+++ b/storage/innobase/trx/trx0rseg.cc
@@ -470,13 +470,13 @@ trx_rseg_mem_restore(
max_trx_id = id;
}
id = mach_read_from_8(undo_log_hdr + TRX_UNDO_TRX_NO);
- rseg->last_trx_no = id;
if (id > max_trx_id) {
max_trx_id = id;
}
unsigned purge = mach_read_from_2(
undo_log_hdr + TRX_UNDO_NEEDS_PURGE);
ut_ad(purge <= 1);
+ rseg->set_last_trx_no(id, purge != 0);
rseg->needs_purge = purge != 0;
if (rseg->last_page_no != FIL_NULL) {