[MDEV-20805] ibuf_add_free_page() is not initializing FIL_PAGE_TYPE first Created: 2019-10-11  Updated: 2019-10-12  Resolved: 2019-10-11

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB, Storage Engine - XtraDB
Affects Version/s: 5.5, 10.0, 10.1, 10.2, 10.3, 10.4, 10.5
Fix Version/s: 10.2.28, 5.5.66, 10.1.42, 10.3.19, 10.4.9, 10.5.0

Type: Bug Priority: Major
Reporter: Marko Mäkelä Assignee: Marko Mäkelä
Resolution: Fixed Votes: 0
Labels: recovery

Issue Links:
Blocks
blocks MDEV-19514 Defer change buffer merge until pages... Closed
Relates
relates to MDEV-20813 Assertion `!srv_safe_truncate || !new... Closed

 Description   

In the function recv_parse_or_apply_log_rec_body() there are debug checks for validating the state of the page when redo log records are being applied. Most notably, FIL_PAGE_TYPE should be set before anything else is being written to the page.

The function ibuf_add_free_page() is violating this by invoking flst_add_last() before setting FIL_PAGE_TYPE. This bug was noticed during the testing of MDEV-19514.



 Comments   
Comment by Marko Mäkelä [ 2019-10-11 ]

To 10.1, I pushed an additional change that asserts that when flushing pages, the FIL_PAGE_TYPE will be set. The doublewrite buffer creation during bootstrap is violating that, but I added an extra initialization for debug builds.

All in all, this should not impact non-debug builds at all. For release builds, we are slightly changing the order of redo log records in the mini-transaction of ibuf_add_free_page(). The volume of written redo log should remain unchanged.

Generated at Thu Feb 08 09:02:18 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.