summaryrefslogtreecommitdiff
path: root/mysql-test/suite/encryption/t/innodb-missing-key.test
diff options
context:
space:
mode:
authorJan Lindström <jan.lindstrom@mariadb.com>2018-01-25 15:04:10 +0200
committerJan Lindström <jan.lindstrom@mariadb.com>2018-01-25 15:04:10 +0200
commitc905eac1e79ed6304d68fb894c689ac4d27a6f60 (patch)
treeb86ecdd4f42ddf46b590fae2a6640e8fb4375cd0 /mysql-test/suite/encryption/t/innodb-missing-key.test
parent859d100d70a9dba222b229bbc0d5a01194e8ed5f (diff)
downloadmariadb-git-bb-10.2-MDEV-13103.tar.gz
MDEV-13103: InnoDB crash recovery fails to decompress a page in buf_dblwr_process()bb-10.2-MDEV-13103
There were several problems. Firstly, page decompression code did not handle possible decompression errors correctly. Secondly, not all compression methods tolerate corrupted input (e.g. lz4 did not tolerate input that was compressed using snappy method). Finally, if page is actually also encrypted we can't decompress page. Solutions: Add proper error handling to decompression code and add post compression checksum to page. As whole page including page checksum is compressed we can reuse the original checksum field for post compression checksum. With post compression checksum we can detect most of the corruptions. If no corruption is detected hopefully decompression code can detect remaining problems. Doublewrite buffer page recovery for page compressed pages require that post compression checksum matches. For pages from old releases supporting page compression checksum must be BUF_NO_CHECKSUM_MAGIC. Upgrade from older versions is supported as post compression checksum check accepts the BUF_NO_CHECKSUM_MAGIC that they stored in checksum filed. Downgrade to older versions is not supported (assuming that there were some changes to compressed tables) as page compression code would not tolerate any other checksum except BUF_NO_CHECKSUM_MAGIC. innochecksum.cc is_page_corrupted: If page is compressed verify post compression checksum buf_page_decrypt_after_read Return DB_PAGE_CORRUPTED if page is found to be corrupted after post compression checksum check. buf_page_io_complete If page is found corrupted after buf_page_decrypt_after_read there is no need to continue page check. buf_page_decrypt_after_read Verify post compression checksum before decompression and if it does not match mark page corrupted. Note that old compressed pages do not really have post compression checksum so they are treated as not corrupted and then we need to hope that decompression code can handle the possible corruptions by returning error. buf_calc_compressed_crc32 New function to calculate post compression checksum so that necessary compression metadata fields are included. buf_dblwr_decompress New function that handles post compression checksum check and page decompression if it is ok. buf_dblwr_process Verify post compression checksum before trying to decompress page. fil_space_verify_crypt_checksum Remove incorrect code as compressed and encrypted pages do have post encryption checksum. fil_compress_page Calculate and store post compression checksum to FIL_SPACE_OR_CHKSUM field as original value is stored on compressed image. fil_decompress_page Add error handling if decompression fails. fil_verify_compression_checksum New function to verify post compression checksum. Compressed tablespaces before this change have BUF_NO_CHECKSUM_MAGIC in checksum field and they must be treated as not corrupted. convert_error_code_to_mysql Handle also page corruptions DB_PAGE_CORRUPTED as HA_ERR_CRASHED. Note that there are cases when we do not know for certain is page corrupted, corrupted and compressed, or still encrypted after failed decrypt, thus tablespace could be marked just corrupted. Tests modified innodb-page_compression_[zip, lz4, lzma, lzo, bzip2, snappy] to use innodb-page-compression.inc innodb-page-compression.inc add innochecksum and intentional tablespace corruption tests. innodb-force-corrupt, innodb_bug14147491 add new error messages to mtr suppression and new error codes. New tests encryption/innodb-corrupted.test test intentionally corrupted tablespaces containing encryption and compression. doublewrite-compressed test doublewrite recovery for page compressed tables innodb-import-102 import files from both big_endian and little_endian machine
Diffstat (limited to 'mysql-test/suite/encryption/t/innodb-missing-key.test')
-rw-r--r--mysql-test/suite/encryption/t/innodb-missing-key.test9
1 files changed, 5 insertions, 4 deletions
diff --git a/mysql-test/suite/encryption/t/innodb-missing-key.test b/mysql-test/suite/encryption/t/innodb-missing-key.test
index 8091d23cf1c..1e3a7124157 100644
--- a/mysql-test/suite/encryption/t/innodb-missing-key.test
+++ b/mysql-test/suite/encryption/t/innodb-missing-key.test
@@ -7,7 +7,8 @@
# MDEV-11004: Unable to start (Segfault or os error 2) when encryption key missing
#
-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: Database page corruption on disk or a failed file read of tablespace test/t1 page \\[page id: space=[0-9]+, page number=[0-9]+\\]. You may have to recover from a backup.");
+call mtr.add_suppression("InnoDB: Table `test`.`t1` is corrupted. Please drop the table and recreate.");
--echo # Start server with keys2.txt
-- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys2.txt
@@ -42,11 +43,11 @@ CREATE TABLE t4(a int not null primary key auto_increment, b varchar(128)) engin
SELECT SLEEP(5);
SELECT COUNT(1) FROM t3;
SELECT COUNT(1) FROM t2;
---error 1296
+--error ER_GET_ERRMSG
SELECT COUNT(1) FROM t2,t1 where t2.a = t1.a;
---error 1296
+--error ER_GET_ERRMSG,ER_NO_SUCH_TABLE_IN_ENGINE
SELECT COUNT(1) FROM t1 where b = 'ab';
---error 1296
+--error ER_GET_ERRMSG,ER_NO_SUCH_TABLE_IN_ENGINE
SELECT COUNT(1) FROM t1;
--echo