-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MDEV-34898 Doublewrite recovery of innodb_checksum_algorithm=full_crc32 encrypted pages does not work #3691
base: 10.6
Are you sure you want to change the base?
Conversation
|
10f5a3e
to
4873034
Compare
my $fname= "$ENV{'MYSQLD_DATADIR'}test/t2.ibd"; | ||
open(FILE, "+<", $fname) or die; | ||
FILE->autoflush(1); | ||
binmode FILE; | ||
seek(FILE, 3 * $ENV{'INNODB_PAGE_SIZE'}, SEEK_SET); | ||
print FILE chr(0) x ($ENV{'INNODB_PAGE_SIZE'}); | ||
close FILE; | ||
EOF | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I checked that FIL_PAGE_LSN
is not encrypted on the page. Therefore, we should be able to corrupt just that (for example, write chr(255) x 8
, which will be newer than end of the log) and recompute the checksum. I think that it would be more interesting than this "totally corrupted" page.
Can you please also do a test variant that corrupts this page in the doublewrite buffer, with an LSN that is before the checkpoint? That should lead to InnoDB crash recovery failing. Better make it two attempts: also with an LSN that is after the end of the log.
…32 encrypted pages does not work - InnoDB fails to recover the full crc32 encrypted page from doublewrite buffer. The reason is that buf_dblwr_t::recover() fails to identify the space id from the page because the page has been encrypted from FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION bytes. Fix: === buf_dblwr_t::recover(): preserve any pages whose space_id does not match a known tablespace. These could be encrypted pages of tablespaces that had been created with innodb_checksum_algorithm=full_crc32. buf_page_t::read_complete(): If the page looks corrupted and the tablespace is encrypted and in full_crc32 format, try to restore the page from doublewrite buffer. recv_dblwr_t::recover_encrypted_page(): Find the page which has the same page number and try to decrypt the page using space->crypt_data. After decryption, compare the space id. Write the recovered page back to the file.
4873034
to
23a6df0
Compare
Description
Fix:
buf_dblwr_t::recover(): preserve any pages whose space_id does not match a known tablespace. These could be encrypted pages of tablespaces that had been created with
innodb_checksum_algorithm=full_crc32.
buf_page_t::read_complete(): If the page looks corrupted and the tablespace is encrypted and in full_crc32 format, try to restore the page from doublewrite buffer.
recv_dblwr_t::recover_encrypted_page(): Find the page which has the same page number and try to decrypt the page using space->crypt_data. After decryption, compare the space id. Write the recovered page back to the file.
How can this PR be tested?
./mtr encryption.doublewrite_debug
Basing the PR against the correct MariaDB version
main
branch.PR quality check