Skip to content

Commit

Permalink
MDEV-18025: Apply the fix to XtraDB and adjust tests
Browse files Browse the repository at this point in the history
The fix was accidentally only applied to InnoDB, and encryption tests
were not adjusted.
  • Loading branch information
dr-m committed Dec 18, 2018
1 parent 171271e commit 1b471fa
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions mysql-test/suite/encryption/r/innodb-bad-key-change.result
@@ -1,6 +1,7 @@
call mtr.add_suppression("Plugin 'file_key_management' init function returned error");
call mtr.add_suppression("Plugin 'file_key_management' registration.*failed");
call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[0-9]+\\] in file '.*test.t[12]\\.ibd' cannot be decrypted\\.");
call mtr.add_suppression("InnoDB: Encrypted page [1-9][0-9]*:3 in file .*test.t1.ibd looks corrupted; key_version=1");
call mtr.add_suppression("mysqld: File .*keysbad3.txt' not found ");

# Start server with keys2.txt
Expand Down
@@ -1,4 +1,5 @@
call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[15]\\.ibd' cannot be decrypted\\.");
call mtr.add_suppression("InnoDB: Encrypted page [1-9][0-9]*:3 in file .*test.t[15].ibd looks corrupted; key_version=1");
call mtr.add_suppression("Couldn't load plugins from 'file_key_management*");
create table t5 (
`intcol1` int(32) DEFAULT NULL,
Expand Down
1 change: 1 addition & 0 deletions mysql-test/suite/encryption/r/innodb-missing-key.result
@@ -1,4 +1,5 @@
call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[123]\\.ibd' cannot be decrypted\\.");
call mtr.add_suppression("InnoDB: Encrypted page [1-9][0-9]*:3 in file .*test.t[12].ibd looks corrupted; key_version=1");

# Start server with keys2.txt
CREATE TABLE t1(a int not null primary key auto_increment, b varchar(128)) engine=innodb ENCRYPTED=YES ENCRYPTION_KEY_ID=19;
Expand Down
1 change: 1 addition & 0 deletions mysql-test/suite/encryption/t/innodb-bad-key-change.test
Expand Up @@ -11,6 +11,7 @@
call mtr.add_suppression("Plugin 'file_key_management' init function returned error");
call mtr.add_suppression("Plugin 'file_key_management' registration.*failed");
call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[0-9]+\\] in file '.*test.t[12]\\.ibd' cannot be decrypted\\.");
call mtr.add_suppression("InnoDB: Encrypted page [1-9][0-9]*:3 in file .*test.t1.ibd looks corrupted; key_version=1");
call mtr.add_suppression("mysqld: File .*keysbad3.txt' not found ");


Expand Down
Expand Up @@ -8,6 +8,7 @@
#

call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[15]\\.ibd' cannot be decrypted\\.");
call mtr.add_suppression("InnoDB: Encrypted page [1-9][0-9]*:3 in file .*test.t[15].ibd looks corrupted; key_version=1");

# Suppression for builds where file_key_management plugin is linked statically
call mtr.add_suppression("Couldn't load plugins from 'file_key_management*");
Expand Down
1 change: 1 addition & 0 deletions mysql-test/suite/encryption/t/innodb-missing-key.test
Expand Up @@ -8,6 +8,7 @@
#

call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[123]\\.ibd' cannot be decrypted\\.");
call mtr.add_suppression("InnoDB: Encrypted page [1-9][0-9]*:3 in file .*test.t[12].ibd looks corrupted; key_version=1");

--echo
--echo # Start server with keys2.txt
Expand Down
5 changes: 3 additions & 2 deletions storage/xtradb/buf/buf0buf.cc
Expand Up @@ -482,6 +482,8 @@ static bool buf_page_decrypt_after_read(buf_page_t* bpage, fil_space_t* space)
decrypt. */
if (!fil_space_verify_crypt_checksum(
dst_frame, buf_page_get_zip_size(bpage))) {

decrypt_failed:
ib_logf(IB_LOG_LEVEL_ERROR,
"Encrypted page %u:%u in file %s"
" looks corrupted; key_version=" ULINTPF,
Expand All @@ -490,7 +492,7 @@ static bool buf_page_decrypt_after_read(buf_page_t* bpage, fil_space_t* space)
mach_read_from_4(
FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION
+ dst_frame));
decrypt_failed:

/* Mark page encrypted in case it should be. */
if (space->crypt_data->type
!= CRYPT_SCHEME_UNENCRYPTED) {
Expand Down Expand Up @@ -4794,7 +4796,6 @@ static dberr_t buf_page_check_corrupt(buf_page_t* bpage, fil_space_t* space)
not anymore encrypted. */
corrupted = buf_page_is_corrupted(true, dst_frame, zip_size,
space);

if (!corrupted) {
bpage->encrypted = false;
} else {
Expand Down

0 comments on commit 1b471fa

Please sign in to comment.