MDEV-21945 Assertion w==OPT failed in trx_purge_add_undo_to_history()
By default, when redo log is being written for modifying a persistent data page, the data page must actually be changed. If the write can sometimes be optimized away, then the template parameter w=mtr_t::OPT should be passed in order to silence the debug assertion failure. InnoDB undo log pages can be reused without properly freeing or initializing them in between. In particular, the undo log header page field TRX_UNDO_TRX_NO could have been part of an undo log record page, and those bytes could accidentally have the desired value when the page is reused as an undo log header page of another transaction. Because the function trx_undo_set_state_at_finish() always changes the TRX_UNDO_STATE of the page, and because recovery is only reading TRX_UNDO_TRX_NO for pages that either have the correct TRX_UNDO_STATE or, in trx_rseg_array_init(), are attached to the TRX_SYS page, the garbage values in TRX_UNDO_TRX_NO do not seem to cause a problem. This assertion failure affects debug builds only.
Showing
Please register or sign in to comment