[MDEV-27014] InnoDB fails to restore page 0 from the doublewrite buffer Created: 2021-11-10  Updated: 2021-12-21  Resolved: 2021-12-12

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB
Affects Version/s: 10.6.3, 10.6.4, 10.6.5
Fix Version/s: 10.8.0, 10.6.6, 10.7.2

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

Attachments: File data.tar.xz    
Issue Links:
Problem/Incident
causes MDEV-27322 Test innodb.doublewrite crashes when ... Closed
Relates
relates to MDEV-25909 Unnecessary calls to fil_ibd_load() s... Open
relates to MDEV-26631 Race condition in the test innodb.dou... Closed

 Description   

The test innodb.doublewrite corrupts the first page of a data file t1.ibd by writing 0 to the bytes 34 through 37 and recomputing the checksum.

The data directory in data.tar.xz fails to recover:

tar xJf data.tar.xz
sql/mariadbd --innodb-page-size=32k --datadir=$(pwd)/data

mariadb-10.6.5

2021-11-10 13:17:58 0 [Note] InnoDB: Starting crash recovery from checkpoint LSN=45679,45679
2021-11-10 13:17:58 0 [ERROR] InnoDB: Inconsistent tablespace ID in ./test/t1.ibd
2021-11-10 13:17:58 0 [ERROR] InnoDB: Cannot apply log to [page id: space=5, page number=0] of corrupted file './test/t1.ibd'
2021-11-10 13:17:58 0 [ERROR] InnoDB: Plugin initialization aborted with error Data structure corruption
2021-11-10 13:17:58 0 [Note] InnoDB: Starting shutdown...

You will find that fil_ibd_load() is invoked once and returns FIL_LOAD_DEFER. After that, buf_dblwr_t::recover() will be invoked, but there is no call of Datafile::restore_from_doublewrite(). The scenario is similar to MDEV-26631.

Note: The doublewrite copy of the page is at the very first slot. The contents only differs for the tablespace identifier and the page checksum:

diff -u <(od -An -t x1 -j 0x200000 -N 0x8000 data/ibdata1) <(od -An -t x1 -N 0x8000 data/test/t1.ibd)

Thanks to monty for providing a copy of the data directory.



 Comments   
Comment by Thirunarayanan Balathandayuthapani [ 2021-11-15 ]

Patch is in bb-10.6-MDEV-27014

Comment by Marko Mäkelä [ 2021-11-16 ]

The patch looks OK to me. I would suggest passing the added parameter by value rather than by pointer.

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