summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2017-08-10 12:31:26 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2017-08-10 12:31:26 +0300
commit73297f532fba89e33785460448e93f87478c2505 (patch)
treea799b257e67031693033b9fbf5ab825d0274da8e
parent237f23d70296e36793bafeaea25b65e568f8d449 (diff)
downloadmariadb-git-73297f532fba89e33785460448e93f87478c2505.tar.gz
MDEV-13476 TRX_UNDO_PAGE_TYPE mismatch when writing undo log after upgrade
When undo log pages pre-exist from an upgrade, the TRX_UNDO_PAGE_TYPE could be TRX_UNDO_INSERT==1 (for insert_undo) TRX_UNDO_UPDATE==2 (for update_undo), instead of the new unified page type 0 that was introduced in MDEV-12288. The undo log page type does not really matter much, because the undo log record type identifies the records independently of the page type. So, the debug assertions can simply allow any potential value of the TRX_UNDO_PAGE_TYPE (0, 1, or 2).
-rw-r--r--storage/innobase/trx/trx0rec.cc17
1 files changed, 13 insertions, 4 deletions
diff --git a/storage/innobase/trx/trx0rec.cc b/storage/innobase/trx/trx0rec.cc
index d9e506d3eb3..0a0be4e9c23 100644
--- a/storage/innobase/trx/trx0rec.cc
+++ b/storage/innobase/trx/trx0rec.cc
@@ -469,8 +469,12 @@ trx_undo_page_report_insert(
ulint i;
ut_ad(dict_index_is_clust(index));
- ut_ad(*reinterpret_cast<uint16*>(TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_TYPE
- + undo_page) == 0);
+ /* MariaDB 10.3.1+ in trx_undo_page_init() always initializes
+ TRX_UNDO_PAGE_TYPE as 0, but previous versions wrote
+ TRX_UNDO_INSERT == 1 into insert_undo pages,
+ or TRX_UNDO_UPDATE == 2 into update_undo pages. */
+ ut_ad(mach_read_from_2(TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_TYPE
+ + undo_page) <= 2);
first_free = mach_read_from_2(undo_page + TRX_UNDO_PAGE_HDR
+ TRX_UNDO_PAGE_FREE);
@@ -875,8 +879,13 @@ trx_undo_page_report_modify(
ut_a(dict_index_is_clust(index));
ut_ad(rec_offs_validate(rec, index, offsets));
- ut_ad(*reinterpret_cast<uint16*>(TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_TYPE
- + undo_page) == 0);
+ /* MariaDB 10.3.1+ in trx_undo_page_init() always initializes
+ TRX_UNDO_PAGE_TYPE as 0, but previous versions wrote
+ TRX_UNDO_INSERT == 1 into insert_undo pages,
+ or TRX_UNDO_UPDATE == 2 into update_undo pages. */
+ ut_ad(mach_read_from_2(TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_TYPE
+ + undo_page) <= 2);
+
trx_undo_t* undo = dict_table_is_temporary(table)
? NULL : trx->rsegs.m_redo.undo;