Commit 73297f53 authored by Marko Mäkelä's avatar Marko Mäkelä

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).
parent 237f23d7
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment