From 73297f532fba89e33785460448e93f87478c2505 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 10 Aug 2017 12:31:26 +0300 Subject: [PATCH] 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). --- storage/innobase/trx/trx0rec.cc | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/storage/innobase/trx/trx0rec.cc b/storage/innobase/trx/trx0rec.cc index d9e506d3eb3c9..0a0be4e9c231b 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(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(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;