[MDEV-18025] Mariabackup fails to detect corrupted page_compressed=1 tables Created: 2018-12-17  Updated: 2023-04-16  Resolved: 2018-12-18

Status: Closed
Project: MariaDB Server
Component/s: Backup
Affects Version/s: 10.1.22, 10.3.0, 10.2.9, 10.4.0
Fix Version/s: 10.4.2, 10.1.38, 10.2.20, 10.3.12

Type: Bug Priority: Major
Reporter: Marko Mäkelä Assignee: Thirunarayanan Balathandayuthapani
Resolution: Fixed Votes: 1
Labels: backup, corruption

Issue Links:
Relates
relates to MDEV-12112 corruption in encrypted table may be ... Closed
relates to MDEV-13542 Crashing on a corrupted page is unhel... Closed
relates to MDEV-17638 Improve error message about corruptio... Closed
relates to MDEV-18653 mariabackup.unencrypted_page_compress... Open

 Description   

Even with the MDEV-12112 fix, Mariabackup seems to fail to verify the pages of page_compressed=1 tables. The reason is that both fil_space_verify_crypt_checksum() and buf_page_is_corrupted() will skip the validation for such pages. We should call fil_page_decompress(), similar to the one that is performed in buf_dblwr_process().



 Comments   
Comment by Marko Mäkelä [ 2018-12-17 ]

There already is a test for which we fail to notice corruption:

./mtr encryption.innodb-force-corruption

It will issue messages about 2 tables to the error log, but not about this one:

CREATE TABLE t3 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT, c char(200)) ENGINE=InnoDB page_compressed=yes encrypted=yes;

Before the follow-up fix to MDEV-12112, no messages were emitted about any of these 3 tables to the error log.

While fixing this, I would suggest fixing the page trailer validation further: if the page trailer is supposed to contain the least significant bits of FIL_PAGE_LSN but fails to do so, then the page should be rejected as invalid.

Comment by Marko Mäkelä [ 2018-12-18 ]

With the fix, mariabackup is validating each page with buf_page_is_corrupted(). Thanks to that, we should be validating that the LSN at the start and end of the page match. (The end LSN is not present in ROW_FORMAT=COMPRESSED, which is not to be confused with page_compressed=1.)

Comment by Marko Mäkelä [ 2018-12-20 ]

In MDEV-13103, I made a mistake in the error handling of page_compressed=1 decryption when the default innodb_compression_algorithm=zlib is used. Due to this mistake, with certain versions of zlib, MariaDB would fail to detect a corrupted page.

The problem was uncovered by the tests mariabackup.unencrypted_page_compressed and mariabackup.encrypted_page_compressed that were added as part of this work. It appeared to occur with older zlib only.

With the follow-up fixes, this ticket not only implemented the consistency checks that were missing in mariabackup, but also improved the handling of corrupted page_compressed pages in the MariaDB server.

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