diff options
author | Jan Lindström <jan.lindstrom@mariadb.com> | 2018-01-25 15:04:10 +0200 |
---|---|---|
committer | Jan Lindström <jan.lindstrom@mariadb.com> | 2018-01-25 15:04:10 +0200 |
commit | c905eac1e79ed6304d68fb894c689ac4d27a6f60 (patch) | |
tree | b86ecdd4f42ddf46b590fae2a6640e8fb4375cd0 | |
parent | 859d100d70a9dba222b229bbc0d5a01194e8ed5f (diff) | |
download | mariadb-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
70 files changed, 3003 insertions, 3799 deletions
diff --git a/extra/CMakeLists.txt b/extra/CMakeLists.txt index 8c73e23d72b..b8a80c98f29 100644 --- a/extra/CMakeLists.txt +++ b/extra/CMakeLists.txt @@ -80,6 +80,7 @@ IF(WITH_INNOBASE_STORAGE_ENGINE OR WITH_XTRADB_STORAGE_ENGINE) ../storage/innobase/buf/buf0buf.cc ../storage/innobase/page/page0zip.cc ../storage/innobase/fil/fil0crypt.cc + ../storage/innobase/fil/fil0pagecompress.cc ) diff --git a/extra/innochecksum.cc b/extra/innochecksum.cc index b937cc6fa1a..388fa4c4c3b 100644 --- a/extra/innochecksum.cc +++ b/extra/innochecksum.cc @@ -1,6 +1,6 @@ /* Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. - Copyright (c) 2014, 2017, MariaDB Corporation. + Copyright (c) 2014, 2018, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -70,6 +70,7 @@ typedef void fil_space_t; #include "ut0crc32.h" /* ut_crc32_init() */ #include "fsp0pagecompress.h" /* fil_get_compression_alg_name */ #include "fil0crypt.h" /* fil_space_verify_crypt_checksum */ +#include "fil0pagecompress.h" /* fil_verify_compression_checksum */ #include <string.h> @@ -480,13 +481,9 @@ is_page_corrupted( buf + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID); /* We can't trust only a page type, thus we take account - also fsp_flags or crypt_data on page 0 */ - if ((page_type == FIL_PAGE_PAGE_COMPRESSED && is_compressed) || - (page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED && - is_compressed && is_encrypted)) { - /* Page compressed tables do not contain post compression - checksum. */ - return (false); + also fsp_flags. */ + if (page_type == FIL_PAGE_PAGE_COMPRESSED && is_compressed) { + return(!fil_verify_compression_checksum(buf, space_id, cur_page_num)); } if (page_size.is_compressed()) { @@ -525,11 +522,13 @@ is_page_corrupted( if (is_encrypted && key_version != 0) { is_corrupted = !fil_space_verify_crypt_checksum(buf, page_size, space_id, (ulint)cur_page_num); - } else { - is_corrupted = true; - } - if (is_corrupted) { + if (is_corrupted) { + is_corrupted = buf_page_is_corrupted( + true, buf, page_size, NULL); + } + + } else { is_corrupted = buf_page_is_corrupted( true, buf, page_size, NULL); } @@ -1900,15 +1899,6 @@ int main( skip_page = false; } - ulint cur_page_type = mach_read_from_2(buf+FIL_PAGE_TYPE); - - /* FIXME: Page compressed or Page compressed and encrypted - pages do not contain checksum. */ - if (cur_page_type == FIL_PAGE_PAGE_COMPRESSED || - cur_page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED) { - skip_page = true; - } - /* If no-check is enabled, skip the checksum verification.*/ if (!no_check diff --git a/mysql-test/include/innodb-page-compression.inc b/mysql-test/include/innodb-page-compression.inc new file mode 100644 index 00000000000..6bdfade15d8 --- /dev/null +++ b/mysql-test/include/innodb-page-compression.inc @@ -0,0 +1,285 @@ +if (!$INNOCHECKSUM) { + --echo Need innochecksum binary + --die Need innochecksum binary +} + +--disable_warnings +set global innodb_file_format = `Barracuda`; +set global innodb_file_per_table = on; +--enable_warnings + +call mtr.add_suppression("InnoDB: Database page corruption on disk or a failed file read of tablespace test/t[0-9]+ page \\[page id: space=[0-9]+, page number=[0-9]+\\]. You may have to recover from a backup."); +call mtr.add_suppression("InnoDB: Page \\[page id: space=[0-9]+, page number= [0-9]+\\] in file ./test/t[0-9]+.ibd may be corrupted. Post compression checksum [0-9]+ stored [0-9]+ compression_method [ZLIB|SNAPPY|LZ4|LZO|LZMA|BZIP2]"); +call mtr.add_suppression("InnoDB: Background Page read failed to read or decrypt \\[page id: space=[0-9]+, page number=[0-9]+\\]"); +call mtr.add_suppression("mysqld: Index for table 't[0-9]+' is corrupt; try to repair it"); + +create table t0 (c1 int not null auto_increment primary key, b char(200)) engine=innodb; +create table t1 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=1; +create table t2 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=2; +create table t3 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=3; +create table t4 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=4; +create table t5 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=5; +create table t6 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=6; +create table t7 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=7; +create table t8 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=8; +create table t9 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=9; + +--disable_query_log +begin; +let $i = 10; +while ($i) +{ + insert into t0(b) values(REPEAT('Aa',50)); + insert into t0(b) values(REPEAT('a',100)); + insert into t0(b) values(REPEAT('b',100)); + insert into t0(b) values(REPEAT('0',100)); + insert into t0(b) values(REPEAT('1',100)); + dec $i; +} + +insert into t1 select * from t0; +insert into t2 select * from t0; +insert into t3 select * from t0; +insert into t4 select * from t0; +insert into t5 select * from t0; +insert into t6 select * from t0; +insert into t7 select * from t0; +insert into t8 select * from t0; +insert into t9 select * from t0; +commit; +--enable_query_log + +select count(*) from t1; +select count(*) from t3; +select count(*) from t4; +select count(*) from t5; +select count(*) from t6; +select count(*) from t6; +select count(*) from t7; +select count(*) from t8; +select count(*) from t9; + +# +# Wait until pages are really compressed +# +let $wait_condition= select variable_value > 0 from information_schema.global_status where variable_name = 'INNODB_NUM_PAGES_PAGE_COMPRESSED'; +--source include/wait_condition.inc + +--let $MYSQLD_DATADIR=`select @@datadir` + +# shutdown before grep + +--source include/shutdown_mysqld.inc + +--let t1_IBD = $MYSQLD_DATADIR/test/t0.ibd +--let SEARCH_RANGE = 10000000 +--let SEARCH_PATTERN=AaAaAaAa +--echo # t0 expected FOUND +-- let SEARCH_FILE=$t1_IBD +-- source include/search_pattern_in_file.inc +--let t1_IBD = $MYSQLD_DATADIR/test/t1.ibd +--echo # t1 page compressed expected NOT FOUND +-- let SEARCH_FILE=$t1_IBD +-- source include/search_pattern_in_file.inc +--let t1_IBD = $MYSQLD_DATADIR/test/t2.ibd +--echo # t2 page compressed expected NOT FOUND +-- let SEARCH_FILE=$t1_IBD +-- source include/search_pattern_in_file.inc +--let t1_IBD = $MYSQLD_DATADIR/test/t3.ibd +--echo # t3 page compressed expected NOT FOUND +-- let SEARCH_FILE=$t1_IBD +-- source include/search_pattern_in_file.inc +--let t1_IBD = $MYSQLD_DATADIR/test/t4.ibd +--echo # t4 page compressed expected NOT FOUND +-- let SEARCH_FILE=$t1_IBD +-- source include/search_pattern_in_file.inc +--let t1_IBD = $MYSQLD_DATADIR/test/t5.ibd +--echo # t5 page compressed expected NOT FOUND +-- let SEARCH_FILE=$t1_IBD +-- source include/search_pattern_in_file.inc +--let t1_IBD = $MYSQLD_DATADIR/test/t6.ibd +--echo # t6 page compressed expected NOT FOUND +-- let SEARCH_FILE=$t1_IBD +-- source include/search_pattern_in_file.inc +--let t1_IBD = $MYSQLD_DATADIR/test/t7.ibd +--echo # t7 page compressed expected NOT FOUND +-- let SEARCH_FILE=$t1_IBD +-- source include/search_pattern_in_file.inc +--let t1_IBD = $MYSQLD_DATADIR/test/t8.ibd +--echo # t8 page compressed expected NOT FOUND +-- let SEARCH_FILE=$t1_IBD +-- source include/search_pattern_in_file.inc +--let t1_IBD = $MYSQLD_DATADIR/test/t9.ibd +--echo # t9 page compressed expected NOT FOUND +-- let SEARCH_FILE=$t1_IBD +-- source include/search_pattern_in_file.inc + +# +# Run innochecksum to all tables, all tables should be ok +# +let t_IBD = $MYSQLD_DATADIR/test/t0.ibd; +--exec $INNOCHECKSUM $t_IBD +let $i=9; +while $($i > 0) { +--echo # Run innochecksum on t$i +let t_IBD = $MYSQLD_DATADIR/test/t$i.ibd; +--exec $INNOCHECKSUM $t_IBD +dec $i; +} + +-- source include/start_mysqld.inc + +select count(*) from t0; +select count(*) from t1; +select count(*) from t3; +select count(*) from t4; +select count(*) from t5; +select count(*) from t6; +select count(*) from t7; +select count(*) from t8; +select count(*) from t9; + +let $wait_condition= select variable_value > 0 from information_schema.global_status where variable_name = 'INNODB_NUM_PAGES_PAGE_DECOMPRESSED'; +--source include/wait_condition.inc + +let INNODB_PAGE_SIZE=`select @@innodb_page_size`; +let MYSQLD_DATADIR=`select @@datadir`; + +--echo # Restart server +--source include/shutdown_mysqld.inc + +--echo # Corrupting tablespaces... + +# +# Now we corrupt page compressed pages as follows: +# (1) compression method +# (2) payload size +# (3) data +# (4) checksum +# +# Page 0 is not compressed or encrypted +# +perl; +sub ib_write_value { + my($fh, $file, $pos, $len, $val) = @_; + seek($fh, $pos, SEEK_SET) or die "$0: seek $file to pos $pos: $!";; + syswrite($fh, $val, $len) == $len or die "$0: write to $file val $val len $len: $!";; +} +sub ib_corrupt_table { + my($file, $pos, $val, $len) = @_; + open(my $fh, "+<", $file) or die "$0: open $file: $!"; + binmode $fh; + ib_write_value($fh, $file, $pos, $len, $val); + close $fh or die "$0: close $file: $!"; +} +sub ib_read_value { + my($fh, $file, $pos, $len) = @_; + seek($fh, $pos, SEEK_SET) or die "$0: seek $file to pos $pos: $!"; + sysread($fh, $buf, $len) == $len or die "$0: read $file : $!"; + return $buf; +} + +my($pos) = $ENV{'INNODB_PAGE_SIZE'} * 3; +my($file) = "$ENV{MYSQLD_DATADIR}/test/t1.ibd"; +open($fh, "+<", $file) or die "$0: open $file : $!"; +binmode $fh; + +# Find out the page type, compression method location is based on that +# Note that FIL_HEADER is not encrypted +my($ptype) = unpack("n", ib_read_value($fh, $file, $pos+24, 2)); +if ($ptype == 34354) { + $pos += 32; # FLUSH_LSN_OR_KEY_VERSION + 6 +} else { + $pos += 42; # FIL_PAGE_DATA + 2 +} + +# Corrupt compression method by decreasing it by one, if zero set 6 +# Note that compression method is not encrypted +my($cmethod) = unpack("n", ib_read_value($fh, $file, $pos, 2)); +$cmethod--; +if ($cmethod == 0) { + $cmethod = 6; +} + +ib_write_value($fh, $file, $pos, 2, pack("n", $cmethod)); +close $fh or die $!; + +# (2) corrupt payload size by decreasing size by 50 and if 0 set it to 20 +# note that payload size is not encrypted +my($pos) = $ENV{'INNODB_PAGE_SIZE'} * 3 + 40; +my($file) = "$ENV{MYSQLD_DATADIR}/test/t2.ibd"; +open($fh, "+<", $file) or die "$0: open $file : $!"; +my($size) = unpack("n", ib_read_value($fh, $file, $pos, 2)); +$size -= 50; +if ($size <= 0) { + $size = 20; +} +ib_write_value($fh, $file, $pos, 2, pack("n", $size)); +close $fh or die $!; + +# (3) Corrupt data + +ib_corrupt_table("$ENV{MYSQLD_DATADIR}/test/t3.ibd", $ENV{'INNODB_PAGE_SIZE'} * 3 + 42, + "deadaaaaffffbbbb",14); + +# (4) Corrupt checksum +my($pos) = $ENV{'INNODB_PAGE_SIZE'} * 3; +my($file) = "$ENV{MYSQLD_DATADIR}/test/t4.ibd"; +open($fh, "+<", $file) or die "$0: open $file : $!"; + +# Find out the page type, checksum location is based on that +# Note that FIL_HEADER is not encrypted +my($ptype) = unpack("n", ib_read_value($fh, $file, $pos + 24, 2)); +if ($ptype == 37401) { + $pos += 30; +} +close $fh or die $!; +ib_corrupt_table($file, $pos, pack("n", 0xdead), 2); +EOF + +--echo # Corruption done + +# +# Run innochecksum to page compressed (and maybe encrypted) tables +# now we should detect corruptions on compressed cases. +# In compressed and encrypted cases innochecksum can't decrypt +# or decompress so we do not detect all corruptions e.g. corruption on +# compression method. +# +--echo # Run innochecksum on t$i +let t_IBD = $MYSQLD_DATADIR/test/t$i.ibd; +--error 0,1 +--exec $INNOCHECKSUM $t_IBD + +let $i=4; +while $($i > 1) { +--echo # Run innochecksum on t$i +let t_IBD = $MYSQLD_DATADIR/test/t$i.ibd; +--error 1 +--exec $INNOCHECKSUM $t_IBD +dec $i; +} + +--echo # Start server again +--source include/start_mysqld.inc + +# +# Server should not crash on corrupted tables +# +--error ER_NOT_KEYFILE, ER_GET_ERRMSG +select * from t1; +--error ER_NOT_KEYFILE, ER_GET_ERRMSG +select * from t2; +--error ER_NOT_KEYFILE, ER_GET_ERRMSG +select * from t3; +--error ER_NOT_KEYFILE, ER_GET_ERRMSG +select * from t4; +select count(*) from t5; +select count(*) from t6; +select count(*) from t7; +select count(*) from t8; +select count(*) from t9; + +# We should be able to drop even corrupted tables + +drop table t0, t1, t2, t3, t4, t5, t6, t7, t8, t9; diff --git a/mysql-test/suite/encryption/import/101/t0_be.ibd b/mysql-test/suite/encryption/import/101/t0_be.ibd Binary files differnew file mode 100644 index 00000000000..6272e123d62 --- /dev/null +++ b/mysql-test/suite/encryption/import/101/t0_be.ibd diff --git a/mysql-test/suite/encryption/import/101/t0_le.ibd b/mysql-test/suite/encryption/import/101/t0_le.ibd Binary files differnew file mode 100644 index 00000000000..6272e123d62 --- /dev/null +++ b/mysql-test/suite/encryption/import/101/t0_le.ibd diff --git a/mysql-test/suite/encryption/import/101/t1_be.ibd b/mysql-test/suite/encryption/import/101/t1_be.ibd Binary files differnew file mode 100644 index 00000000000..6e537ad0f63 --- /dev/null +++ b/mysql-test/suite/encryption/import/101/t1_be.ibd diff --git a/mysql-test/suite/encryption/import/101/t1_le.ibd b/mysql-test/suite/encryption/import/101/t1_le.ibd Binary files differnew file mode 100644 index 00000000000..50aaafaca59 --- /dev/null +++ b/mysql-test/suite/encryption/import/101/t1_le.ibd diff --git a/mysql-test/suite/encryption/import/101/t2_be.ibd b/mysql-test/suite/encryption/import/101/t2_be.ibd Binary files differnew file mode 100644 index 00000000000..0dfd4313b1a --- /dev/null +++ b/mysql-test/suite/encryption/import/101/t2_be.ibd diff --git a/mysql-test/suite/encryption/import/101/t2_le.ibd b/mysql-test/suite/encryption/import/101/t2_le.ibd Binary files differnew file mode 100644 index 00000000000..03abc4b29bb --- /dev/null +++ b/mysql-test/suite/encryption/import/101/t2_le.ibd diff --git a/mysql-test/suite/encryption/import/101/t3_be.ibd b/mysql-test/suite/encryption/import/101/t3_be.ibd Binary files differnew file mode 100644 index 00000000000..b2a7b069232 --- /dev/null +++ b/mysql-test/suite/encryption/import/101/t3_be.ibd diff --git a/mysql-test/suite/encryption/import/101/t3_le.ibd b/mysql-test/suite/encryption/import/101/t3_le.ibd Binary files differnew file mode 100644 index 00000000000..e1be27ac6b8 --- /dev/null +++ b/mysql-test/suite/encryption/import/101/t3_le.ibd diff --git a/mysql-test/suite/encryption/import/101/t4_be.ibd b/mysql-test/suite/encryption/import/101/t4_be.ibd Binary files differnew file mode 100644 index 00000000000..cc2fff77819 --- /dev/null +++ b/mysql-test/suite/encryption/import/101/t4_be.ibd diff --git a/mysql-test/suite/encryption/import/101/t4_le.ibd b/mysql-test/suite/encryption/import/101/t4_le.ibd Binary files differnew file mode 100644 index 00000000000..cc2fff77819 --- /dev/null +++ b/mysql-test/suite/encryption/import/101/t4_le.ibd diff --git a/mysql-test/suite/encryption/import/101/t5_be.ibd b/mysql-test/suite/encryption/import/101/t5_be.ibd Binary files differnew file mode 100644 index 00000000000..effe1bde060 --- /dev/null +++ b/mysql-test/suite/encryption/import/101/t5_be.ibd diff --git a/mysql-test/suite/encryption/import/101/t5_le.ibd b/mysql-test/suite/encryption/import/101/t5_le.ibd Binary files differnew file mode 100644 index 00000000000..f08c2a45a50 --- /dev/null +++ b/mysql-test/suite/encryption/import/101/t5_le.ibd diff --git a/mysql-test/suite/encryption/import/102/t0_be.ibd b/mysql-test/suite/encryption/import/102/t0_be.ibd Binary files differnew file mode 100644 index 00000000000..9e8ead15d74 --- /dev/null +++ b/mysql-test/suite/encryption/import/102/t0_be.ibd diff --git a/mysql-test/suite/encryption/import/102/t0_le.ibd b/mysql-test/suite/encryption/import/102/t0_le.ibd Binary files differnew file mode 100644 index 00000000000..9e8ead15d74 --- /dev/null +++ b/mysql-test/suite/encryption/import/102/t0_le.ibd diff --git a/mysql-test/suite/encryption/import/102/t1_be.ibd b/mysql-test/suite/encryption/import/102/t1_be.ibd Binary files differnew file mode 100644 index 00000000000..be3a2d7ae2e --- /dev/null +++ b/mysql-test/suite/encryption/import/102/t1_be.ibd diff --git a/mysql-test/suite/encryption/import/102/t1_le.ibd b/mysql-test/suite/encryption/import/102/t1_le.ibd Binary files differnew file mode 100644 index 00000000000..b19e7a6d88c --- /dev/null +++ b/mysql-test/suite/encryption/import/102/t1_le.ibd diff --git a/mysql-test/suite/encryption/import/102/t2_be.ibd b/mysql-test/suite/encryption/import/102/t2_be.ibd Binary files differnew file mode 100644 index 00000000000..55e1b2d1e94 --- /dev/null +++ b/mysql-test/suite/encryption/import/102/t2_be.ibd diff --git a/mysql-test/suite/encryption/import/102/t2_le.ibd b/mysql-test/suite/encryption/import/102/t2_le.ibd Binary files differnew file mode 100644 index 00000000000..55e1b2d1e94 --- /dev/null +++ b/mysql-test/suite/encryption/import/102/t2_le.ibd diff --git a/mysql-test/suite/encryption/import/102/t3_be.ibd b/mysql-test/suite/encryption/import/102/t3_be.ibd Binary files differnew file mode 100644 index 00000000000..e171f5bb247 --- /dev/null +++ b/mysql-test/suite/encryption/import/102/t3_be.ibd diff --git a/mysql-test/suite/encryption/import/102/t3_le.ibd b/mysql-test/suite/encryption/import/102/t3_le.ibd Binary files differnew file mode 100644 index 00000000000..e92898fe36e --- /dev/null +++ b/mysql-test/suite/encryption/import/102/t3_le.ibd diff --git a/mysql-test/suite/encryption/import/102/t4_be.ibd b/mysql-test/suite/encryption/import/102/t4_be.ibd Binary files differnew file mode 100644 index 00000000000..722a4b572d7 --- /dev/null +++ b/mysql-test/suite/encryption/import/102/t4_be.ibd diff --git a/mysql-test/suite/encryption/import/102/t4_le.ibd b/mysql-test/suite/encryption/import/102/t4_le.ibd Binary files differnew file mode 100644 index 00000000000..722a4b572d7 --- /dev/null +++ b/mysql-test/suite/encryption/import/102/t4_le.ibd diff --git a/mysql-test/suite/encryption/import/102/t5_be.ibd b/mysql-test/suite/encryption/import/102/t5_be.ibd Binary files differnew file mode 100644 index 00000000000..8bad4b7a3c1 --- /dev/null +++ b/mysql-test/suite/encryption/import/102/t5_be.ibd diff --git a/mysql-test/suite/encryption/import/102/t5_le.ibd b/mysql-test/suite/encryption/import/102/t5_le.ibd Binary files differnew file mode 100644 index 00000000000..cb8b2346d33 --- /dev/null +++ b/mysql-test/suite/encryption/import/102/t5_le.ibd diff --git a/mysql-test/suite/encryption/r/innodb-bad-key-change.result b/mysql-test/suite/encryption/r/innodb-bad-key-change.result index 2e87b85489e..0b734100eb3 100644 --- a/mysql-test/suite/encryption/r/innodb-bad-key-change.result +++ b/mysql-test/suite/encryption/r/innodb-bad-key-change.result @@ -1,6 +1,8 @@ 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=[1-9][0-9]*\\] in file '.*test.t[12]\\.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: The page \\[page id: space=[0-9]+, page number=[0-9]+\\] in file './test/t1.ibd' cannot be decrypted."); +call mtr.add_suppression("InnoDB: The page \\[page id: space=[0-9]+, page number=[0-9]+\\] in file './test/t2.ibd' cannot be decrypted."); call mtr.add_suppression("File '.*mysql-test.std_data.keysbad3\\.txt' not found"); # Start server with keys2.txt SET GLOBAL innodb_file_per_table = ON; diff --git a/mysql-test/suite/encryption/r/innodb-corrupted.result b/mysql-test/suite/encryption/r/innodb-corrupted.result new file mode 100644 index 00000000000..6a9914fcaf9 --- /dev/null +++ b/mysql-test/suite/encryption/r/innodb-corrupted.result @@ -0,0 +1,143 @@ +set global innodb_encrypt_tables='FORCE'; +select @@innodb_encrypt_tables; +@@innodb_encrypt_tables +FORCE +set global innodb_default_encryption_key_id=4; +select @@innodb_default_encryption_key_id; +@@innodb_default_encryption_key_id +1 +set global innodb_compression_algorithm=zlib; +select @@innodb_compression_algorithm; +@@innodb_compression_algorithm +zlib +set global innodb_file_format = `Barracuda`; +set global innodb_file_per_table = on; +call mtr.add_suppression("InnoDB: Database page corruption on disk or a failed file read of tablespace test/t[0-9]+ page \\[page id: space=[0-9]+, page number=[0-9]+\\]. You may have to recover from a backup."); +call mtr.add_suppression("InnoDB: Page \\[page id: space=[0-9]+, page number= [0-9]+\\] in file ./test/t[0-9]+.ibd may be corrupted. Post compression checksum [0-9]+ stored [0-9]+ compression_method [ZLIB|SNAPPY|LZ4|LZO|LZMA|BZIP2]"); +call mtr.add_suppression("InnoDB: Background Page read failed to read or decrypt \\[page id: space=[0-9]+, page number=[0-9]+\\]"); +call mtr.add_suppression("mysqld: Index for table 't[0-9]+' is corrupt; try to repair it"); +create table t0 (c1 int not null auto_increment primary key, b char(200)) engine=innodb; +create table t1 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=1; +create table t2 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=2; +create table t3 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=3; +create table t4 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=4; +create table t5 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=5; +create table t6 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=6; +create table t7 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=7; +create table t8 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=8; +create table t9 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=9; +select count(*) from t1; +count(*) +50 +select count(*) from t3; +count(*) +50 +select count(*) from t4; +count(*) +50 +select count(*) from t5; +count(*) +50 +select count(*) from t6; +count(*) +50 +select count(*) from t6; +count(*) +50 +select count(*) from t7; +count(*) +50 +select count(*) from t8; +count(*) +50 +select count(*) from t9; +count(*) +50 +# t0 expected FOUND +NOT FOUND /AaAaAaAa/ in t0.ibd +# t1 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t1.ibd +# t2 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t2.ibd +# t3 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t3.ibd +# t4 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t4.ibd +# t5 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t5.ibd +# t6 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t6.ibd +# t7 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t7.ibd +# t8 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t8.ibd +# t9 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t9.ibd +# Run innochecksum on t9 +# Run innochecksum on t8 +# Run innochecksum on t7 +# Run innochecksum on t6 +# Run innochecksum on t5 +# Run innochecksum on t4 +# Run innochecksum on t3 +# Run innochecksum on t2 +# Run innochecksum on t1 +select count(*) from t0; +count(*) +50 +select count(*) from t1; +count(*) +50 +select count(*) from t3; +count(*) +50 +select count(*) from t4; +count(*) +50 +select count(*) from t5; +count(*) +50 +select count(*) from t6; +count(*) +50 +select count(*) from t7; +count(*) +50 +select count(*) from t8; +count(*) +50 +select count(*) from t9; +count(*) +50 +# Restart server +# Corrupting tablespaces... +# Corruption done +# Run innochecksum on t0 +# Run innochecksum on t4 +# Run innochecksum on t3 +# Run innochecksum on t2 +# Start server again +select * from t1; +Got one of the listed errors +select * from t2; +Got one of the listed errors +select * from t3; +Got one of the listed errors +select * from t4; +Got one of the listed errors +select count(*) from t5; +count(*) +50 +select count(*) from t6; +count(*) +50 +select count(*) from t7; +count(*) +50 +select count(*) from t8; +count(*) +50 +select count(*) from t9; +count(*) +50 +drop table t0, t1, t2, t3, t4, t5, t6, t7, t8, t9; diff --git a/mysql-test/suite/encryption/r/innodb-encryption-disable.result b/mysql-test/suite/encryption/r/innodb-encryption-disable.result index 90668a3a395..cc9de6639de 100644 --- a/mysql-test/suite/encryption/r/innodb-encryption-disable.result +++ b/mysql-test/suite/encryption/r/innodb-encryption-disable.result @@ -1,4 +1,4 @@ -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: Database page corruption on disk or a failed file read of tablespace test/t[1-9] page \\[page id: space=[0-9]+, page number=[0-9]+\\]. You may have to recover from a backup."); call mtr.add_suppression("Couldn't load plugins from 'file_key_management"); create table t5 ( `intcol1` int(32) DEFAULT NULL, diff --git a/mysql-test/suite/encryption/r/innodb-force-corrupt.result b/mysql-test/suite/encryption/r/innodb-force-corrupt.result index 67917ca5f82..323e46242eb 100644 --- a/mysql-test/suite/encryption/r/innodb-force-corrupt.result +++ b/mysql-test/suite/encryption/r/innodb-force-corrupt.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: Database page corruption on disk or a failed file read of tablespace test/t[0-9]+ page \[page id: space=[0-9]+, page number=[0-9]+\]. You may have to recover from a backup."); SET GLOBAL innodb_file_per_table = ON; set global innodb_compression_algorithm = 1; # Create and populate tables to be corrupted diff --git a/mysql-test/suite/encryption/r/innodb-import-102.result b/mysql-test/suite/encryption/r/innodb-import-102.result new file mode 100644 index 00000000000..44b3d9352b2 --- /dev/null +++ b/mysql-test/suite/encryption/r/innodb-import-102.result @@ -0,0 +1,74 @@ +create table t0_be (c1 int not null auto_increment primary key, b char(200)) engine=innodb; +create table t1_be (c1 int not null auto_increment primary key, b char(200)) engine=innodb encrypted=yes; +create table t2_be (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=yes; +create table t3_be (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=yes encrypted=yes; +create table t4_be (c1 int not null auto_increment primary key, b char(200)) engine=innodb row_format=compressed; +create table t5_be (c1 int not null auto_increment primary key, b char(200)) engine=innodb row_format=compressed encrypted=yes; +create table t0_le (c1 int not null auto_increment primary key, b char(200)) engine=innodb; +create table t1_le (c1 int not null auto_increment primary key, b char(200)) engine=innodb encrypted=yes; +create table t2_le (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=yes; +create table t3_le (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=yes encrypted=yes; +create table t4_le (c1 int not null auto_increment primary key, b char(200)) engine=innodb row_format=compressed; +create table t5_le (c1 int not null auto_increment primary key, b char(200)) engine=innodb row_format=compressed encrypted=yes; +alter table t0_be discard tablespace; +alter table t1_be discard tablespace; +alter table t2_be discard tablespace; +alter table t3_be discard tablespace; +alter table t4_be discard tablespace; +alter table t5_be discard tablespace; +alter table t0_le discard tablespace; +alter table t1_le discard tablespace; +alter table t2_le discard tablespace; +alter table t3_le discard tablespace; +alter table t4_le discard tablespace; +alter table t5_le discard tablespace; +alter table t0_be import tablespace; +alter table t1_be import tablespace; +alter table t2_be import tablespace; +alter table t3_be import tablespace; +alter table t4_be import tablespace; +alter table t5_be import tablespace; +alter table t0_le import tablespace; +alter table t1_le import tablespace; +alter table t2_le import tablespace; +alter table t3_le import tablespace; +alter table t4_le import tablespace; +alter table t5_le import tablespace; +select * from t0_be; +c1 b +1 AaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAa +select * from t1_be; +c1 b +1 AaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAa +select * from t2_be; +c1 b +1 AaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAa +select * from t3_be; +c1 b +1 AaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAa +select * from t4_be; +c1 b +1 AaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAa +select * from t5_be; +c1 b +1 AaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAa +select * from t0_le; +c1 b +1 AaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAa +select * from t1_le; +c1 b +1 AaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAa +select * from t2_le; +c1 b +1 AaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAa +select * from t3_le; +c1 b +1 AaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAa +select * from t4_le; +c1 b +1 AaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAa +select * from t5_le; +c1 b +1 AaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAa +drop table t0_be, t1_be, t2_be, t3_be, t4_be, t5_be; +drop table t0_le, t1_le, t2_le, t3_le, t4_le, t5_le; diff --git a/mysql-test/suite/encryption/r/innodb-missing-key.result b/mysql-test/suite/encryption/r/innodb-missing-key.result index 3eb48409f13..68cc4fa5d55 100644 --- a/mysql-test/suite/encryption/r/innodb-missing-key.result +++ b/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: 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."); # 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; CREATE TABLE t2(a int not null primary key auto_increment, b varchar(128)) engine=innodb ENCRYPTED=YES ENCRYPTION_KEY_ID=1; @@ -34,9 +35,9 @@ COUNT(1) SELECT COUNT(1) FROM t2,t1 where t2.a = t1.a; ERROR HY000: Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB SELECT COUNT(1) FROM t1 where b = 'ab'; -ERROR HY000: Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB +Got one of the listed errors SELECT COUNT(1) FROM t1; -ERROR HY000: Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB +Got one of the listed errors # Start server with keys2.txt SELECT COUNT(1) FROM t1; diff --git a/mysql-test/suite/encryption/r/innodb_encryption-page-compression.result b/mysql-test/suite/encryption/r/innodb_encryption-page-compression.result index 359f285901c..5aba0dc405a 100644 --- a/mysql-test/suite/encryption/r/innodb_encryption-page-compression.result +++ b/mysql-test/suite/encryption/r/innodb_encryption-page-compression.result @@ -1,182 +1,143 @@ SET GLOBAL innodb_encryption_threads = 4; +select @@innodb_encryption_threads; +@@innodb_encryption_threads +4 SET GLOBAL innodb_encrypt_tables = on; -set global innodb_compression_algorithm = 1; -create table innodb_normal (c1 int, b char(20)) engine=innodb; -show warnings; -Level Code Message -create table innodb_page_compressed1 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=1; -show warnings; -Level Code Message -show create table innodb_page_compressed1; -Table Create Table -innodb_page_compressed1 CREATE TABLE `innodb_page_compressed1` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=1 -create table innodb_page_compressed2 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=2; -show warnings; -Level Code Message -show create table innodb_page_compressed2; -Table Create Table -innodb_page_compressed2 CREATE TABLE `innodb_page_compressed2` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=2 -create table innodb_page_compressed3 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=3; -show warnings; -Level Code Message -show create table innodb_page_compressed3; -Table Create Table -innodb_page_compressed3 CREATE TABLE `innodb_page_compressed3` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=3 -create table innodb_page_compressed4 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=4; -show warnings; -Level Code Message -show create table innodb_page_compressed4; -Table Create Table -innodb_page_compressed4 CREATE TABLE `innodb_page_compressed4` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=4 -create table innodb_page_compressed5 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=5; -show warnings; -Level Code Message -show create table innodb_page_compressed5; -Table Create Table -innodb_page_compressed5 CREATE TABLE `innodb_page_compressed5` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=5 -create table innodb_page_compressed6 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=6; -show warnings; -Level Code Message -show create table innodb_page_compressed6; -Table Create Table -innodb_page_compressed6 CREATE TABLE `innodb_page_compressed6` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=6 -create table innodb_page_compressed7 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=7; -show warnings; -Level Code Message -show create table innodb_page_compressed7; -Table Create Table -innodb_page_compressed7 CREATE TABLE `innodb_page_compressed7` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=7 -create table innodb_page_compressed8 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=8; -show warnings; -Level Code Message -show create table innodb_page_compressed8; -Table Create Table -innodb_page_compressed8 CREATE TABLE `innodb_page_compressed8` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=8 -create table innodb_page_compressed9 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=9; -show warnings; -Level Code Message -show create table innodb_page_compressed9; -Table Create Table -innodb_page_compressed9 CREATE TABLE `innodb_page_compressed9` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=9 -create procedure innodb_insert_proc (repeat_count int) -begin -declare current_num int; -set current_num = 0; -while current_num < repeat_count do -insert into innodb_normal values(current_num,'testing..'); -set current_num = current_num + 1; -end while; -end// -commit; -begin; -call innodb_insert_proc(2000); -insert into innodb_page_compressed1 select * from innodb_normal; -insert into innodb_page_compressed2 select * from innodb_normal; -insert into innodb_page_compressed3 select * from innodb_normal; -insert into innodb_page_compressed4 select * from innodb_normal; -insert into innodb_page_compressed5 select * from innodb_normal; -insert into innodb_page_compressed6 select * from innodb_normal; -insert into innodb_page_compressed7 select * from innodb_normal; -insert into innodb_page_compressed8 select * from innodb_normal; -insert into innodb_page_compressed9 select * from innodb_normal; -commit; -select count(*) from innodb_page_compressed1 where c1 < 500000; -count(*) -2000 -select count(*) from innodb_page_compressed2 where c1 < 500000; -count(*) -2000 -select count(*) from innodb_page_compressed3 where c1 < 500000; -count(*) -2000 -select count(*) from innodb_page_compressed4 where c1 < 500000; -count(*) -2000 -select count(*) from innodb_page_compressed5 where c1 < 500000; -count(*) -2000 -select count(*) from innodb_page_compressed6 where c1 < 500000; -count(*) -2000 -select count(*) from innodb_page_compressed7 where c1 < 500000; -count(*) -2000 -select count(*) from innodb_page_compressed8 where c1 < 500000; -count(*) -2000 -select count(*) from innodb_page_compressed9 where c1 < 500000; -count(*) -2000 -SELECT variable_value > 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted'; -variable_value > 0 -1 -SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted'; -variable_value >= 0 -1 -SELECT variable_value > 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_page_compressed'; -variable_value > 0 -1 -SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_page_decompressed'; -variable_value >= 0 -1 -SET GLOBAL innodb_encryption_threads = 4; -SET GLOBAL innodb_encrypt_tables = off; -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted'; -variable_value >= 0 -1 -SELECT variable_value > 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted'; -variable_value > 0 -1 -SELECT variable_value > 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_page_compressed'; -variable_value > 0 -1 -SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_page_decompressed'; -variable_value >= 0 -1 -drop procedure innodb_insert_proc; -drop table innodb_normal; -drop table innodb_page_compressed1; -drop table innodb_page_compressed2; -drop table innodb_page_compressed3; -drop table innodb_page_compressed4; -drop table innodb_page_compressed5; -drop table innodb_page_compressed6; -drop table innodb_page_compressed7; -drop table innodb_page_compressed8; -drop table innodb_page_compressed9; +select @@innodb_encrypt_tables; +@@innodb_encrypt_tables +ON +set global innodb_compression_algorithm = zlib; +select @@innodb_compression_algorithm; +@@innodb_compression_algorithm +zlib +set global innodb_file_format = `Barracuda`; +set global innodb_file_per_table = on; +call mtr.add_suppression("InnoDB: Database page corruption on disk or a failed file read of tablespace test/t[0-9]+ page \\[page id: space=[0-9]+, page number=[0-9]+\\]. You may have to recover from a backup."); +call mtr.add_suppression("InnoDB: Page \\[page id: space=[0-9]+, page number= [0-9]+\\] in file ./test/t[0-9]+.ibd may be corrupted. Post compression checksum [0-9]+ stored [0-9]+ compression_method [ZLIB|SNAPPY|LZ4|LZO|LZMA|BZIP2]"); +call mtr.add_suppression("InnoDB: Background Page read failed to read or decrypt \\[page id: space=[0-9]+, page number=[0-9]+\\]"); +call mtr.add_suppression("mysqld: Index for table 't[0-9]+' is corrupt; try to repair it"); +create table t0 (c1 int not null auto_increment primary key, b char(200)) engine=innodb; +create table t1 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=1; +create table t2 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=2; +create table t3 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=3; +create table t4 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=4; +create table t5 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=5; +create table t6 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=6; +create table t7 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=7; +create table t8 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=8; +create table t9 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=9; +select count(*) from t1; +count(*) +50 +select count(*) from t3; +count(*) +50 +select count(*) from t4; +count(*) +50 +select count(*) from t5; +count(*) +50 +select count(*) from t6; +count(*) +50 +select count(*) from t6; +count(*) +50 +select count(*) from t7; +count(*) +50 +select count(*) from t8; +count(*) +50 +select count(*) from t9; +count(*) +50 +# t0 expected FOUND +NOT FOUND /AaAaAaAa/ in t0.ibd +# t1 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t1.ibd +# t2 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t2.ibd +# t3 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t3.ibd +# t4 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t4.ibd +# t5 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t5.ibd +# t6 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t6.ibd +# t7 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t7.ibd +# t8 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t8.ibd +# t9 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t9.ibd +# Run innochecksum on t9 +# Run innochecksum on t8 +# Run innochecksum on t7 +# Run innochecksum on t6 +# Run innochecksum on t5 +# Run innochecksum on t4 +# Run innochecksum on t3 +# Run innochecksum on t2 +# Run innochecksum on t1 +select count(*) from t0; +count(*) +50 +select count(*) from t1; +count(*) +50 +select count(*) from t3; +count(*) +50 +select count(*) from t4; +count(*) +50 +select count(*) from t5; +count(*) +50 +select count(*) from t6; +count(*) +50 +select count(*) from t7; +count(*) +50 +select count(*) from t8; +count(*) +50 +select count(*) from t9; +count(*) +50 +# Restart server +# Corrupting tablespaces... +# Corruption done +# Run innochecksum on t0 +# Run innochecksum on t4 +# Run innochecksum on t3 +# Run innochecksum on t2 +# Start server again +select * from t1; +Got one of the listed errors +select * from t2; +Got one of the listed errors +select * from t3; +Got one of the listed errors +select * from t4; +Got one of the listed errors +select count(*) from t5; +count(*) +50 +select count(*) from t6; +count(*) +50 +select count(*) from t7; +count(*) +50 +select count(*) from t8; +count(*) +50 +select count(*) from t9; +count(*) +50 +drop table t0, t1, t2, t3, t4, t5, t6, t7, t8, t9; diff --git a/mysql-test/suite/encryption/t/innodb-bad-key-change.test b/mysql-test/suite/encryption/t/innodb-bad-key-change.test index 04c50e6f327..84841c6200d 100644 --- a/mysql-test/suite/encryption/t/innodb-bad-key-change.test +++ b/mysql-test/suite/encryption/t/innodb-bad-key-change.test @@ -10,7 +10,9 @@ 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=[1-9][0-9]*\\] in file '.*test.t[12]\\.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: The page \\[page id: space=[0-9]+, page number=[0-9]+\\] in file './test/t1.ibd' cannot be decrypted."); +call mtr.add_suppression("InnoDB: The page \\[page id: space=[0-9]+, page number=[0-9]+\\] in file './test/t2.ibd' cannot be decrypted."); call mtr.add_suppression("File '.*mysql-test.std_data.keysbad3\\.txt' not found"); --echo # Start server with keys2.txt diff --git a/mysql-test/suite/encryption/t/innodb-corrupted.test b/mysql-test/suite/encryption/t/innodb-corrupted.test new file mode 100644 index 00000000000..10a958b2468 --- /dev/null +++ b/mysql-test/suite/encryption/t/innodb-corrupted.test @@ -0,0 +1,25 @@ +# Don't test under embedded as we restart server +-- source include/not_embedded.inc +# Require InnoDB +-- source include/have_innodb.inc +-- source include/have_file_key_management_plugin.inc + +let $encrypt=`SELECT @@innodb_compression_algorithm`; +let $encrypt=`SELECT @@innodb_default_encryption_key_id`; + +set global innodb_encrypt_tables='FORCE'; +select @@innodb_encrypt_tables; +set global innodb_default_encryption_key_id=4; +select @@innodb_default_encryption_key_id; +set global innodb_compression_algorithm=zlib; +select @@innodb_compression_algorithm; + +--source include/innodb-page-compression.inc + +--disable_query_log +set global innodb_encrypt_tables=default; +set global innodb_default_encryption_key_id=default; +set global innodb_compression_algorithm=default; +--enable_query_log + + diff --git a/mysql-test/suite/encryption/t/innodb-encryption-disable.test b/mysql-test/suite/encryption/t/innodb-encryption-disable.test index 8c72cf6a3b2..dc6fee2e6ac 100644 --- a/mysql-test/suite/encryption/t/innodb-encryption-disable.test +++ b/mysql-test/suite/encryption/t/innodb-encryption-disable.test @@ -7,7 +7,7 @@ # MDEV-9559: Server without encryption configs crashes if selecting from an implicitly encrypted table # -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: Database page corruption on disk or a failed file read of tablespace test/t[1-9] page \\[page id: space=[0-9]+, page number=[0-9]+\\]. You may have to recover from a backup."); # Suppression for builds where file_key_management plugin is linked statically call mtr.add_suppression("Couldn't load plugins from 'file_key_management"); diff --git a/mysql-test/suite/encryption/t/innodb-force-corrupt.test b/mysql-test/suite/encryption/t/innodb-force-corrupt.test index 4d3bfc2d1e9..11fd3d08f3b 100644 --- a/mysql-test/suite/encryption/t/innodb-force-corrupt.test +++ b/mysql-test/suite/encryption/t/innodb-force-corrupt.test @@ -8,6 +8,7 @@ -- source include/not_embedded.inc 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/t[0-9]+ page \[page id: space=[0-9]+, page number=[0-9]+\]. You may have to recover from a backup."); SET GLOBAL innodb_file_per_table = ON; set global innodb_compression_algorithm = 1; diff --git a/mysql-test/suite/encryption/t/innodb-import-102.opt b/mysql-test/suite/encryption/t/innodb-import-102.opt new file mode 100644 index 00000000000..510ebebd1af --- /dev/null +++ b/mysql-test/suite/encryption/t/innodb-import-102.opt @@ -0,0 +1,4 @@ +--plugin-load-add=$FILE_KEY_MANAGEMENT_SO +--loose-file-key-management +--loose-file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys.txt +--file-key-management-encryption-algorithm=aes_cbc diff --git a/mysql-test/suite/encryption/t/innodb-import-102.test b/mysql-test/suite/encryption/t/innodb-import-102.test new file mode 100644 index 00000000000..b835d2863b0 --- /dev/null +++ b/mysql-test/suite/encryption/t/innodb-import-102.test @@ -0,0 +1,79 @@ +--source include/have_innodb.inc + +create table t0_be (c1 int not null auto_increment primary key, b char(200)) engine=innodb; +create table t1_be (c1 int not null auto_increment primary key, b char(200)) engine=innodb encrypted=yes; +create table t2_be (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=yes; +create table t3_be (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=yes encrypted=yes; +create table t4_be (c1 int not null auto_increment primary key, b char(200)) engine=innodb row_format=compressed; +create table t5_be (c1 int not null auto_increment primary key, b char(200)) engine=innodb row_format=compressed encrypted=yes; + +create table t0_le (c1 int not null auto_increment primary key, b char(200)) engine=innodb; +create table t1_le (c1 int not null auto_increment primary key, b char(200)) engine=innodb encrypted=yes; +create table t2_le (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=yes; +create table t3_le (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=yes encrypted=yes; +create table t4_le (c1 int not null auto_increment primary key, b char(200)) engine=innodb row_format=compressed; +create table t5_le (c1 int not null auto_increment primary key, b char(200)) engine=innodb row_format=compressed encrypted=yes; + +alter table t0_be discard tablespace; +alter table t1_be discard tablespace; +alter table t2_be discard tablespace; +alter table t3_be discard tablespace; +alter table t4_be discard tablespace; +alter table t5_be discard tablespace; + +alter table t0_le discard tablespace; +alter table t1_le discard tablespace; +alter table t2_le discard tablespace; +alter table t3_le discard tablespace; +alter table t4_le discard tablespace; +alter table t5_le discard tablespace; + +-- let DATADIR = `SELECT @@datadir` + +-- copy_file $MYSQL_TEST_DIR/suite/encryption/import/102/t0_be.ibd $DATADIR/test/t0_be.ibd +-- copy_file $MYSQL_TEST_DIR/suite/encryption/import/102/t1_be.ibd $DATADIR/test/t1_be.ibd +-- copy_file $MYSQL_TEST_DIR/suite/encryption/import/102/t2_be.ibd $DATADIR/test/t2_be.ibd +-- copy_file $MYSQL_TEST_DIR/suite/encryption/import/102/t3_be.ibd $DATADIR/test/t3_be.ibd +-- copy_file $MYSQL_TEST_DIR/suite/encryption/import/102/t4_be.ibd $DATADIR/test/t4_be.ibd +-- copy_file $MYSQL_TEST_DIR/suite/encryption/import/102/t5_be.ibd $DATADIR/test/t5_be.ibd + +-- copy_file $MYSQL_TEST_DIR/suite/encryption/import/102/t0_le.ibd $DATADIR/test/t0_le.ibd +-- copy_file $MYSQL_TEST_DIR/suite/encryption/import/102/t1_le.ibd $DATADIR/test/t1_le.ibd +-- copy_file $MYSQL_TEST_DIR/suite/encryption/import/102/t2_le.ibd $DATADIR/test/t2_le.ibd +-- copy_file $MYSQL_TEST_DIR/suite/encryption/import/102/t3_le.ibd $DATADIR/test/t3_le.ibd +-- copy_file $MYSQL_TEST_DIR/suite/encryption/import/102/t4_le.ibd $DATADIR/test/t4_le.ibd +-- copy_file $MYSQL_TEST_DIR/suite/encryption/import/102/t5_le.ibd $DATADIR/test/t5_le.ibd + +--disable_warnings +alter table t0_be import tablespace; +alter table t1_be import tablespace; +alter table t2_be import tablespace; +alter table t3_be import tablespace; +alter table t4_be import tablespace; +alter table t5_be import tablespace; + +alter table t0_le import tablespace; +alter table t1_le import tablespace; +alter table t2_le import tablespace; +alter table t3_le import tablespace; +alter table t4_le import tablespace; +alter table t5_le import tablespace; +--enable_warnings + +select * from t0_be; +select * from t1_be; +select * from t2_be; +select * from t3_be; +select * from t4_be; +select * from t5_be; + +select * from t0_le; +select * from t1_le; +select * from t2_le; +select * from t3_le; +select * from t4_le; +select * from t5_le; + +drop table t0_be, t1_be, t2_be, t3_be, t4_be, t5_be; +drop table t0_le, t1_le, t2_le, t3_le, t4_le, t5_le; + 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 diff --git a/mysql-test/suite/encryption/t/innodb_encryption-page-compression.test b/mysql-test/suite/encryption/t/innodb_encryption-page-compression.test index 113b5001f0f..b90242ec221 100644 --- a/mysql-test/suite/encryption/t/innodb_encryption-page-compression.test +++ b/mysql-test/suite/encryption/t/innodb_encryption-page-compression.test @@ -1,125 +1,17 @@ -- source include/have_innodb.inc -- source include/have_example_key_management_plugin.inc +-- source include/not_embedded.inc let $innodb_compression_algorithm_orig=`SELECT @@innodb_compression_algorithm`; let $innodb_encrypt_tables_orig = `SELECT @@innodb_encrypt_tables`; let $innodb_encryption_threads_orig = `SELECT @@innodb_encryption_threads`; SET GLOBAL innodb_encryption_threads = 4; +select @@innodb_encryption_threads; SET GLOBAL innodb_encrypt_tables = on; +select @@innodb_encrypt_tables; +set global innodb_compression_algorithm = zlib; +select @@innodb_compression_algorithm; -# zlib -set global innodb_compression_algorithm = 1; +--source include/innodb-page-compression.inc -create table innodb_normal (c1 int, b char(20)) engine=innodb; -show warnings; -create table innodb_page_compressed1 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=1; -show warnings; -show create table innodb_page_compressed1; -create table innodb_page_compressed2 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=2; -show warnings; -show create table innodb_page_compressed2; -create table innodb_page_compressed3 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=3; -show warnings; -show create table innodb_page_compressed3; -create table innodb_page_compressed4 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=4; -show warnings; -show create table innodb_page_compressed4; -create table innodb_page_compressed5 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=5; -show warnings; -show create table innodb_page_compressed5; -create table innodb_page_compressed6 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=6; -show warnings; -show create table innodb_page_compressed6; -create table innodb_page_compressed7 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=7; -show warnings; -show create table innodb_page_compressed7; -create table innodb_page_compressed8 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=8; -show warnings; -show create table innodb_page_compressed8; -create table innodb_page_compressed9 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=9; -show warnings; -show create table innodb_page_compressed9; -delimiter //; -create procedure innodb_insert_proc (repeat_count int) -begin - declare current_num int; - set current_num = 0; - while current_num < repeat_count do - insert into innodb_normal values(current_num,'testing..'); - set current_num = current_num + 1; - end while; -end// -delimiter ;// -commit; - -begin; -call innodb_insert_proc(2000); -insert into innodb_page_compressed1 select * from innodb_normal; -insert into innodb_page_compressed2 select * from innodb_normal; -insert into innodb_page_compressed3 select * from innodb_normal; -insert into innodb_page_compressed4 select * from innodb_normal; -insert into innodb_page_compressed5 select * from innodb_normal; -insert into innodb_page_compressed6 select * from innodb_normal; -insert into innodb_page_compressed7 select * from innodb_normal; -insert into innodb_page_compressed8 select * from innodb_normal; -insert into innodb_page_compressed9 select * from innodb_normal; -commit; - -select count(*) from innodb_page_compressed1 where c1 < 500000; -select count(*) from innodb_page_compressed2 where c1 < 500000; -select count(*) from innodb_page_compressed3 where c1 < 500000; -select count(*) from innodb_page_compressed4 where c1 < 500000; -select count(*) from innodb_page_compressed5 where c1 < 500000; -select count(*) from innodb_page_compressed6 where c1 < 500000; -select count(*) from innodb_page_compressed7 where c1 < 500000; -select count(*) from innodb_page_compressed8 where c1 < 500000; -select count(*) from innodb_page_compressed9 where c1 < 500000; - -let $wait_condition= select variable_value > 0 from information_schema.global_status where variable_name = 'INNODB_NUM_PAGES_PAGE_COMPRESSED'; ---source include/wait_condition.inc - -SELECT variable_value > 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted'; -SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted'; -SELECT variable_value > 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_page_compressed'; -SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_page_decompressed'; - -SET GLOBAL innodb_encryption_threads = 4; -SET GLOBAL innodb_encrypt_tables = off; - -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; - -let $wait_condition= select variable_value > 0 from information_schema.global_status where variable_name = 'INNODB_NUM_PAGES_DECRYPTED'; ---source include/wait_condition.inc - -SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted'; -SELECT variable_value > 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted'; -SELECT variable_value > 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_page_compressed'; -SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_page_decompressed'; - -drop procedure innodb_insert_proc; -drop table innodb_normal; -drop table innodb_page_compressed1; -drop table innodb_page_compressed2; -drop table innodb_page_compressed3; -drop table innodb_page_compressed4; -drop table innodb_page_compressed5; -drop table innodb_page_compressed6; -drop table innodb_page_compressed7; -drop table innodb_page_compressed8; -drop table innodb_page_compressed9; - -# reset system ---disable_query_log -EVAL SET GLOBAL innodb_compression_algorithm = $innodb_compression_algorithm_orig; -EVAL SET GLOBAL innodb_encrypt_tables = $innodb_encrypt_tables_orig; -EVAL SET GLOBAL innodb_encryption_threads = $innodb_encryption_threads_orig; ---enable_query_log diff --git a/mysql-test/suite/innodb/include/innodb-page-compression.inc b/mysql-test/suite/innodb/include/innodb-page-compression.inc index 3acbeaf0988..8a0036d61e0 100644 --- a/mysql-test/suite/innodb/include/innodb-page-compression.inc +++ b/mysql-test/suite/innodb/include/innodb-page-compression.inc @@ -1,53 +1,63 @@ +if (!$INNOCHECKSUM) { + --echo Need innochecksum binary + --die Need innochecksum binary +} + --disable_warnings set global innodb_file_format = `Barracuda`; set global innodb_file_per_table = on; --enable_warnings -create table innodb_normal (c1 int not null auto_increment primary key, b char(200)) engine=innodb; -create table innodb_page_compressed1 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=1; -create table innodb_page_compressed2 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=2; -create table innodb_page_compressed3 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=3; -create table innodb_page_compressed4 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=4; -create table innodb_page_compressed5 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=5; -create table innodb_page_compressed6 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=6; -create table innodb_page_compressed7 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=7; -create table innodb_page_compressed8 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=8; -create table innodb_page_compressed9 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=9; +call mtr.add_suppression("InnoDB: Database page corruption on disk or a failed file read of tablespace test/t[0-9]+ page \\[page id: space=[0-9]+, page number=[0-9]+\\]. You may have to recover from a backup."); +call mtr.add_suppression("InnoDB: Page \\[page id: space=[0-9]+, page number= [0-9]+\\] in file ./test/t[0-9]+.ibd may be corrupted. Post compression checksum [0-9]+ stored [0-9]+ compression_method [ZLIB|SNAPPY|LZ4|LZO|LZMA|BZIP2]"); +call mtr.add_suppression("InnoDB: Background Page read failed to read or decrypt \\[page id: space=[0-9]+, page number=[0-9]+\\]"); +call mtr.add_suppression("mysqld: Index for table 't[0-9]+' is corrupt; try to repair it"); + +create table t0 (c1 int not null auto_increment primary key, b char(200)) engine=innodb; +create table t1 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=1; +create table t2 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=2; +create table t3 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=3; +create table t4 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=4; +create table t5 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=5; +create table t6 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=6; +create table t7 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=7; +create table t8 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=8; +create table t9 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=9; --disable_query_log begin; -let $i = 2000; +let $i = 100; while ($i) { - insert into innodb_normal(b) values(REPEAT('Aa',50)); - insert into innodb_normal(b) values(REPEAT('a',100)); - insert into innodb_normal(b) values(REPEAT('b',100)); - insert into innodb_normal(b) values(REPEAT('0',100)); - insert into innodb_normal(b) values(REPEAT('1',100)); + insert into t0(b) values(REPEAT('Aa',50)); + insert into t0(b) values(REPEAT('a',100)); + insert into t0(b) values(REPEAT('b',100)); + insert into t0(b) values(REPEAT('0',100)); + insert into t0(b) values(REPEAT('1',100)); dec $i; } -insert into innodb_page_compressed1 select * from innodb_normal; -insert into innodb_page_compressed2 select * from innodb_normal; -insert into innodb_page_compressed3 select * from innodb_normal; -insert into innodb_page_compressed4 select * from innodb_normal; -insert into innodb_page_compressed5 select * from innodb_normal; -insert into innodb_page_compressed6 select * from innodb_normal; -insert into innodb_page_compressed7 select * from innodb_normal; -insert into innodb_page_compressed8 select * from innodb_normal; -insert into innodb_page_compressed9 select * from innodb_normal; +insert into t1 select * from t0; +insert into t2 select * from t0; +insert into t3 select * from t0; +insert into t4 select * from t0; +insert into t5 select * from t0; +insert into t6 select * from t0; +insert into t7 select * from t0; +insert into t8 select * from t0; +insert into t9 select * from t0; commit; --enable_query_log -select count(*) from innodb_page_compressed1; -select count(*) from innodb_page_compressed3; -select count(*) from innodb_page_compressed4; -select count(*) from innodb_page_compressed5; -select count(*) from innodb_page_compressed6; -select count(*) from innodb_page_compressed6; -select count(*) from innodb_page_compressed7; -select count(*) from innodb_page_compressed8; -select count(*) from innodb_page_compressed9; +select count(*) from t1; +select count(*) from t3; +select count(*) from t4; +select count(*) from t5; +select count(*) from t6; +select count(*) from t6; +select count(*) from t7; +select count(*) from t8; +select count(*) from t9; # # Wait until pages are really compressed @@ -61,71 +71,205 @@ let $wait_condition= select variable_value > 0 from information_schema.global_st --source include/shutdown_mysqld.inc ---let t1_IBD = $MYSQLD_DATADIR/test/innodb_normal.ibd +--let t1_IBD = $MYSQLD_DATADIR/test/t0.ibd --let SEARCH_RANGE = 10000000 --let SEARCH_PATTERN=AaAaAaAa ---echo # innodb_normal expected FOUND +--echo # t0 expected FOUND -- let SEARCH_FILE=$t1_IBD -- source include/search_pattern_in_file.inc ---let t1_IBD = $MYSQLD_DATADIR/test/innodb_page_compressed1.ibd ---echo # innodb_page_compressed1 page compressed expected NOT FOUND +--let t1_IBD = $MYSQLD_DATADIR/test/t1.ibd +--echo # t1 page compressed expected NOT FOUND -- let SEARCH_FILE=$t1_IBD -- source include/search_pattern_in_file.inc ---let t1_IBD = $MYSQLD_DATADIR/test/innodb_page_compressed2.ibd ---echo # innodb_page_compressed2 page compressed expected NOT FOUND +--let t1_IBD = $MYSQLD_DATADIR/test/t2.ibd +--echo # t2 page compressed expected NOT FOUND -- let SEARCH_FILE=$t1_IBD -- source include/search_pattern_in_file.inc ---let t1_IBD = $MYSQLD_DATADIR/test/innodb_page_compressed3.ibd ---echo # innodb_page_compressed3 page compressed expected NOT FOUND +--let t1_IBD = $MYSQLD_DATADIR/test/t3.ibd +--echo # t3 page compressed expected NOT FOUND -- let SEARCH_FILE=$t1_IBD -- source include/search_pattern_in_file.inc ---let t1_IBD = $MYSQLD_DATADIR/test/innodb_page_compressed4.ibd ---echo # innodb_page_compressed4 page compressed expected NOT FOUND +--let t1_IBD = $MYSQLD_DATADIR/test/t4.ibd +--echo # t4 page compressed expected NOT FOUND -- let SEARCH_FILE=$t1_IBD -- source include/search_pattern_in_file.inc ---let t1_IBD = $MYSQLD_DATADIR/test/innodb_page_compressed5.ibd ---echo # innodb_page_compressed5 page compressed expected NOT FOUND +--let t1_IBD = $MYSQLD_DATADIR/test/t5.ibd +--echo # t5 page compressed expected NOT FOUND -- let SEARCH_FILE=$t1_IBD -- source include/search_pattern_in_file.inc ---let t1_IBD = $MYSQLD_DATADIR/test/innodb_page_compressed6.ibd ---echo # innodb_page_compressed6 page compressed expected NOT FOUND +--let t1_IBD = $MYSQLD_DATADIR/test/t6.ibd +--echo # t6 page compressed expected NOT FOUND -- let SEARCH_FILE=$t1_IBD -- source include/search_pattern_in_file.inc ---let t1_IBD = $MYSQLD_DATADIR/test/innodb_page_compressed7.ibd ---echo # innodb_page_compressed7 page compressed expected NOT FOUND +--let t1_IBD = $MYSQLD_DATADIR/test/t7.ibd +--echo # t7 page compressed expected NOT FOUND -- let SEARCH_FILE=$t1_IBD -- source include/search_pattern_in_file.inc ---let t1_IBD = $MYSQLD_DATADIR/test/innodb_page_compressed8.ibd ---echo # innodb_page_compressed8 page compressed expected NOT FOUND +--let t1_IBD = $MYSQLD_DATADIR/test/t8.ibd +--echo # t8 page compressed expected NOT FOUND -- let SEARCH_FILE=$t1_IBD -- source include/search_pattern_in_file.inc ---let t1_IBD = $MYSQLD_DATADIR/test/innodb_page_compressed9.ibd ---echo # innodb_page_compressed9 page compressed expected NOT FOUND +--let t1_IBD = $MYSQLD_DATADIR/test/t9.ibd +--echo # t9 page compressed expected NOT FOUND -- let SEARCH_FILE=$t1_IBD -- source include/search_pattern_in_file.inc +# +# Run innochecksum to all tables, all tables should be ok +# +let t_IBD = $MYSQLD_DATADIR/test/t0.ibd; +--exec $INNOCHECKSUM $t_IBD +let $i=9; +while $($i > 0) { +--echo # Run innochecksum on t$i +let t_IBD = $MYSQLD_DATADIR/test/t$i.ibd; +--exec $INNOCHECKSUM $t_IBD +dec $i; +} + -- source include/start_mysqld.inc -select count(*) from innodb_page_compressed1; -select count(*) from innodb_page_compressed3; -select count(*) from innodb_page_compressed4; -select count(*) from innodb_page_compressed5; -select count(*) from innodb_page_compressed6; -select count(*) from innodb_page_compressed6; -select count(*) from innodb_page_compressed7; -select count(*) from innodb_page_compressed8; -select count(*) from innodb_page_compressed9; +select count(*) from t0; +select count(*) from t1; +select count(*) from t3; +select count(*) from t4; +select count(*) from t5; +select count(*) from t6; +select count(*) from t7; +select count(*) from t8; +select count(*) from t9; let $wait_condition= select variable_value > 0 from information_schema.global_status where variable_name = 'INNODB_NUM_PAGES_PAGE_DECOMPRESSED'; --source include/wait_condition.inc -drop table innodb_normal; -drop table innodb_page_compressed1; -drop table innodb_page_compressed2; -drop table innodb_page_compressed3; -drop table innodb_page_compressed4; -drop table innodb_page_compressed5; -drop table innodb_page_compressed6; -drop table innodb_page_compressed7; -drop table innodb_page_compressed8; -drop table innodb_page_compressed9; +let INNODB_PAGE_SIZE=`select @@innodb_page_size`; +let MYSQLD_DATADIR=`select @@datadir`; + +--echo # Restart server +--source include/shutdown_mysqld.inc + +--echo # Corrupting tablespaces... + +# +# Now we corrupt page compressed pages as follows: +# (1) compression method +# (2) payload size +# (3) data +# (4) checksum +# +# Page 0 is not compressed or encrypted +# +perl; +sub ib_write_value { + my($fh, $file, $pos, $len, $val) = @_; + seek($fh, $pos, SEEK_SET) or die "$0: seek $file to pos $pos: $!";; + syswrite($fh, $val, $len) == $len or die "$0: write to $file val $val len $len: $!";; +} +sub ib_corrupt_table { + my($file, $pos, $val, $len) = @_; + open(my $fh, "+<", $file) or die "$0: open $file: $!"; + binmode $fh; + ib_write_value($fh, $file, $pos, $len, $val); + close $fh or die "$0: close $file: $!"; +} +sub ib_read_value { + my($fh, $file, $pos, $len) = @_; + seek($fh, $pos, SEEK_SET) or die "$0: seek $file to pos $pos: $!"; + sysread($fh, $buf, $len) == $len or die "$0: read $file : $!"; + return $buf; +} + +my($pos) = $ENV{'INNODB_PAGE_SIZE'} * 3; +my($file) = "$ENV{MYSQLD_DATADIR}/test/t1.ibd"; +open($fh, "+<", $file) or die "$0: open $file : $!"; +binmode $fh; + +# Find out the page type, compression method location is based on that +my($ptype) = unpack("n", ib_read_value($fh, $file, $pos+24, 2)); +if ($ptype == 34354) { + $pos += 32; # FLUSH_LSN_OR_KEY_VERSION + 6 +} else { + $pos += 40; # FIL_PAGE_DATA + 2 +} + +# Corrupt compression method by decreasing it by one, if zero set 6 +# Note that compression method is not encrypted +my($cmethod) = unpack("n", ib_read_value($fh, $file, $pos, 2)); +$cmethod--; +if ($cmethod == 0) { + $cmethod = 6; +} + +ib_write_value($fh, $file, $pos, 2, pack("n", $cmethod)); +close $fh or die $!; + +# (2) corrupt payload size by decreasing size by 50 and if 0 set it to 20 +# note that payload size is not encrypted +my($pos) = $ENV{'INNODB_PAGE_SIZE'} * 3 + 38; +my($file) = "$ENV{MYSQLD_DATADIR}/test/t2.ibd"; +open($fh, "+<", $file) or die "$0: open $file : $!"; +my($size) = unpack("n", ib_read_value($fh, $file, $pos, 2)); +$size -= 50; +if ($size <= 0) { + $size = 20; +} +ib_write_value($fh, $file, $pos, 2, pack("n", $size)); +close $fh or die $!; + +# (3) Corrupt data + +ib_corrupt_table("$ENV{MYSQLD_DATADIR}/test/t3.ibd", $ENV{'INNODB_PAGE_SIZE'} * 3 + 42, + "deadaaaaffffbbbb",14); + +# (4) Corrupt checksum +my($pos) = $ENV{'INNODB_PAGE_SIZE'} * 3; +my($file) = "$ENV{MYSQLD_DATADIR}/test/t4.ibd"; +open($fh, "+<", $file) or die "$0: open $file : $!"; + +# Find out the page type, checksum location is based on that +my($ptype) = unpack("n", ib_read_value($fh, $file, $pos + 24, 2)); +if ($ptype == 37401) { + $pos += 30; +} +ib_write_value($fh, $file, $pos, 4, pack("N", 1020102010)); +close $fh or die $!; +EOF + +--echo # Corruption done + +# +# Run innochecksum to page compressed (and maybe encrypted) tables +# now we should detect corruptions +# +let $i=4; +while $($i > 0) { +--echo # Run innochecksum on t$i +let t_IBD = $MYSQLD_DATADIR/test/t$i.ibd; +--error 1 +--exec $INNOCHECKSUM $t_IBD +dec $i; +} + +--echo # Start server again +--source include/start_mysqld.inc + +# +# Server should not crash on corrupted tables +# +--error ER_NOT_KEYFILE +select * from t1; +--error ER_NOT_KEYFILE +select * from t2; +--error ER_NOT_KEYFILE +select * from t3; +--error ER_NOT_KEYFILE +select * from t4; +select count(*) from t5; +select count(*) from t6; +select count(*) from t7; +select count(*) from t8; +select count(*) from t9; + +# We should be able to drop even corrupted tables + +drop table t0, t1, t2, t3, t4, t5, t6, t7, t8, t9; diff --git a/mysql-test/suite/innodb/r/doublewrite-compressed.result b/mysql-test/suite/innodb/r/doublewrite-compressed.result new file mode 100644 index 00000000000..403f6bcc941 --- /dev/null +++ b/mysql-test/suite/innodb/r/doublewrite-compressed.result @@ -0,0 +1,254 @@ +# +# Bug #17335427 INNODB CAN NOT USE THE DOUBLEWRITE BUFFER PROPERLY +# Bug #18144349 INNODB CANNOT USE THE DOUBLEWRITE BUFFER FOR THE FIRST +# PAGE OF SYSTEM TABLESPACE +# +SET GLOBAL innodb_fast_shutdown = 0; +show variables like 'innodb_doublewrite'; +Variable_name Value +innodb_doublewrite ON +show variables like 'innodb_fil_make_page_dirty_debug'; +Variable_name Value +innodb_fil_make_page_dirty_debug 0 +show variables like 'innodb_saved_page_number_debug'; +Variable_name Value +innodb_saved_page_number_debug 0 +SET GLOBAL innodb_file_format = `Barracuda`; +SET GLOBAL innodb_file_per_table = ON; +SET GLOBAL innodb_compression_algorithm = 1; +create table t1 (f1 int primary key, f2 blob) engine=innodb page_compressed=yes; +start transaction; +insert into t1 values(1, repeat('#',12)); +insert into t1 values(2, repeat('+',12)); +insert into t1 values(3, repeat('/',12)); +insert into t1 values(4, repeat('-',12)); +insert into t1 values(5, repeat('.',12)); +commit work; +# --------------------------------------------------------------- +# Test Begin: Test if recovery works if first page of user +# tablespace is full of zeroes. +select space from information_schema.innodb_sys_tables +where name = 'test/t1' into @space_id; +# Ensure that dirty pages of table t1 is flushed. +flush tables t1 for export; +unlock tables; +begin; +insert into t1 values (6, repeat('%', 12)); +# Make the first page dirty for table t1 +set global innodb_saved_page_number_debug = 0; +set global innodb_fil_make_page_dirty_debug = @space_id; +# Ensure that dirty pages of table t1 are flushed. +set global innodb_buf_flush_list_now = 1; +# Kill the server +# Make the first page (page_no=0) of the user tablespace +# full of zeroes. +# +# MDEV-11623: Use old FSP_SPACE_FLAGS in the doublewrite buffer. +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +select f1, f2 from t1; +f1 f2 +1 ############ +2 ++++++++++++ +3 //////////// +4 ------------ +5 ............ +# Test End +# --------------------------------------------------------------- +# Test Begin: Test if recovery works if first page of user +# tablespace is corrupted. +select space from information_schema.innodb_sys_tables +where name = 'test/t1' into @space_id; +# Ensure that dirty pages of table t1 is flushed. +flush tables t1 for export; +unlock tables; +begin; +insert into t1 values (6, repeat('%', 12)); +# Make the first page dirty for table t1 +set global innodb_saved_page_number_debug = 0; +set global innodb_fil_make_page_dirty_debug = @space_id; +# Ensure that dirty pages of table t1 are flushed. +set global innodb_buf_flush_list_now = 1; +# Kill the server +# Corrupt the first page (page_no=0) of the user tablespace. +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +select f1, f2 from t1; +f1 f2 +1 ############ +2 ++++++++++++ +3 //////////// +4 ------------ +5 ............ +# Test End +# --------------------------------------------------------------- +# Test Begin: Test if recovery works if 2nd page of user +# tablespace is full of zeroes. +select space from information_schema.innodb_sys_tables +where name = 'test/t1' into @space_id; +# Ensure that dirty pages of table t1 is flushed. +flush tables t1 for export; +unlock tables; +begin; +insert into t1 values (6, repeat('%', 400)); +# Make the 2nd page dirty for table t1 +set global innodb_saved_page_number_debug = 1; +set global innodb_fil_make_page_dirty_debug = @space_id; +# Ensure that dirty pages of table t1 are flushed. +set global innodb_buf_flush_list_now = 1; +# Kill the server +# Make the 2nd page (page_no=1) of the tablespace all zeroes. +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +select f1, f2 from t1; +f1 f2 +1 ############ +2 ++++++++++++ +3 //////////// +4 ------------ +5 ............ +# Test End +# --------------------------------------------------------------- +# Test Begin: Test if recovery works if 2nd page of user +# tablespace is corrupted. +select space from information_schema.innodb_sys_tables +where name = 'test/t1' into @space_id; +# Ensure that dirty pages of table t1 is flushed. +flush tables t1 for export; +unlock tables; +begin; +insert into t1 values (6, repeat('%', 400)); +# Make the 2nd page dirty for table t1 +set global innodb_saved_page_number_debug = 1; +set global innodb_fil_make_page_dirty_debug = @space_id; +# Ensure that the dirty pages of table t1 are flushed. +set global innodb_buf_flush_list_now = 1; +# Kill the server +# Corrupt the 2nd page (page_no=1) of the user tablespace. +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +select f1, f2 from t1; +f1 f2 +1 ############ +2 ++++++++++++ +3 //////////// +4 ------------ +5 ............ +# Test End +# --------------------------------------------------------------- +# Test Begin: Test if recovery works if first page of +# system tablespace is full of zeroes. +begin; +insert into t1 values (6, repeat('%', 400)); +# Ensure that all dirty pages in the system are flushed. +set global innodb_buf_flush_list_now = 1; +# Make the first page dirty for system tablespace +set global innodb_saved_page_number_debug = 0; +set global innodb_fil_make_page_dirty_debug = 0; +# Ensure that the dirty page of system tablespace is also flushed. +set global innodb_buf_flush_list_now = 1; +# Kill the server +# Make the first page (page_no=0) of the system tablespace +# all zeroes. +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +select f1, f2 from t1; +f1 f2 +1 ############ +2 ++++++++++++ +3 //////////// +4 ------------ +5 ............ +# Test End +# --------------------------------------------------------------- +# Test Begin: Test if recovery works if first page of +# system tablespace is corrupted. +begin; +insert into t1 values (6, repeat('%', 400)); +# Ensure that all dirty pages in the system are flushed. +set global innodb_buf_flush_list_now = 1; +# Make the first page dirty for system tablespace +set global innodb_saved_page_number_debug = 0; +set global innodb_fil_make_page_dirty_debug = 0; +# Ensure that the dirty page of system tablespace is also flushed. +set global innodb_buf_flush_list_now = 1; +# Kill the server +# Corrupt the first page (page_no=0) of the system tablespace. +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +select f1, f2 from t1; +f1 f2 +1 ############ +2 ++++++++++++ +3 //////////// +4 ------------ +5 ............ +# Test End +# --------------------------------------------------------------- +# Test Begin: Test if recovery works if 2nd page of +# system tablespace is full of zeroes. +begin; +insert into t1 values (6, repeat('%', 400)); +# Ensure that all dirty pages in the system are flushed. +set global innodb_buf_flush_list_now = 1; +# Make the second page dirty for system tablespace +set global innodb_saved_page_number_debug = 1; +set global innodb_fil_make_page_dirty_debug = 0; +# Ensure that the dirty page of system tablespace is also flushed. +set global innodb_buf_flush_list_now = 1; +# Kill the server +# Make the 2nd page (page_no=1) of the system tablespace +# all zeroes. +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +select f1, f2 from t1; +f1 f2 +1 ############ +2 ++++++++++++ +3 //////////// +4 ------------ +5 ............ +# Test End +# --------------------------------------------------------------- +# Test Begin: Test if recovery works if 2nd page of +# system tablespace is corrupted. +begin; +insert into t1 values (6, repeat('%', 400)); +# Ensure that all dirty pages in the system are flushed. +set global innodb_buf_flush_list_now = 1; +# Make the second page dirty for system tablespace +set global innodb_saved_page_number_debug = 1; +set global innodb_fil_make_page_dirty_debug = 0; +# Ensure that the dirty page of system tablespace is also flushed. +set global innodb_buf_flush_list_now = 1; +# Kill the server +# Make the 2nd page (page_no=1) of the system tablespace +# all zeroes. +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +FOUND 1 /\[ERROR\] InnoDB: .*test.t1\.ibd.*/ in mysqld.1.err +select f1, f2 from t1; +f1 f2 +1 ############ +2 ++++++++++++ +3 //////////// +4 ------------ +5 ............ +drop table t1; +# +# MDEV-12600 crash during install_db with innodb_page_size=32K +# and ibdata1=3M +# +SELECT * FROM INFORMATION_SCHEMA.ENGINES +WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS +FOUND 1 /\[ERROR\] InnoDB: Cannot create doublewrite buffer/ in mysqld.1.err diff --git a/mysql-test/suite/innodb/r/innodb-page_compression_bzip2.result b/mysql-test/suite/innodb/r/innodb-page_compression_bzip2.result index 61507ddbe5c..daf6ab1cd19 100644 --- a/mysql-test/suite/innodb/r/innodb-page_compression_bzip2.result +++ b/mysql-test/suite/innodb/r/innodb-page_compression_bzip2.result @@ -1,435 +1,136 @@ -set global innodb_compression_algorithm = 5; -create table innodb_compressed(c1 int, b char(20)) engine=innodb row_format=compressed key_block_size=8; -show warnings; -Level Code Message -create table innodb_normal (c1 int, b char(20)) engine=innodb; -show warnings; -Level Code Message -create table innodb_page_compressed1 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=1; -show warnings; -Level Code Message -show create table innodb_page_compressed1; -Table Create Table -innodb_page_compressed1 CREATE TABLE `innodb_page_compressed1` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=1 -create table innodb_page_compressed2 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=2; -show warnings; -Level Code Message -show create table innodb_page_compressed2; -Table Create Table -innodb_page_compressed2 CREATE TABLE `innodb_page_compressed2` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=2 -create table innodb_page_compressed3 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=3; -show warnings; -Level Code Message -show create table innodb_page_compressed3; -Table Create Table -innodb_page_compressed3 CREATE TABLE `innodb_page_compressed3` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=3 -create table innodb_page_compressed4 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=4; -show warnings; -Level Code Message -show create table innodb_page_compressed4; -Table Create Table -innodb_page_compressed4 CREATE TABLE `innodb_page_compressed4` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=4 -create table innodb_page_compressed5 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=5; -show warnings; -Level Code Message -show create table innodb_page_compressed5; -Table Create Table -innodb_page_compressed5 CREATE TABLE `innodb_page_compressed5` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=5 -create table innodb_page_compressed6 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=6; -show warnings; -Level Code Message -show create table innodb_page_compressed6; -Table Create Table -innodb_page_compressed6 CREATE TABLE `innodb_page_compressed6` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=6 -create table innodb_page_compressed7 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=7; -show warnings; -Level Code Message -show create table innodb_page_compressed7; -Table Create Table -innodb_page_compressed7 CREATE TABLE `innodb_page_compressed7` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=7 -create table innodb_page_compressed8 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=8; -show warnings; -Level Code Message -show create table innodb_page_compressed8; -Table Create Table -innodb_page_compressed8 CREATE TABLE `innodb_page_compressed8` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=8 -create table innodb_page_compressed9 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=9; -show warnings; -Level Code Message -show create table innodb_page_compressed9; -Table Create Table -innodb_page_compressed9 CREATE TABLE `innodb_page_compressed9` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=9 -create procedure innodb_insert_proc (repeat_count int) -begin -declare current_num int; -set current_num = 0; -while current_num < repeat_count do -insert into innodb_normal values(current_num,'testing..'); -set current_num = current_num + 1; -end while; -end// -commit; -set autocommit=0; -call innodb_insert_proc(5000); -commit; -set autocommit=1; -select count(*) from innodb_normal; -count(*) -5000 -insert into innodb_compressed select * from innodb_normal; -insert into innodb_page_compressed1 select * from innodb_normal; -insert into innodb_page_compressed2 select * from innodb_normal; -insert into innodb_page_compressed3 select * from innodb_normal; -insert into innodb_page_compressed4 select * from innodb_normal; -insert into innodb_page_compressed5 select * from innodb_normal; -insert into innodb_page_compressed6 select * from innodb_normal; -insert into innodb_page_compressed7 select * from innodb_normal; -insert into innodb_page_compressed8 select * from innodb_normal; -insert into innodb_page_compressed9 select * from innodb_normal; -commit; -select count(*) from innodb_compressed; -count(*) -5000 -select count(*) from innodb_page_compressed1; -count(*) -5000 -select count(*) from innodb_page_compressed1 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed2 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed3 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed4 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed5 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed6 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed7 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed8 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed9 where c1 < 500000; -count(*) -5000 -alter table innodb_normal page_compressed=1 page_compression_level=8; -show warnings; -Level Code Message -show create table innodb_normal; -Table Create Table -innodb_normal CREATE TABLE `innodb_normal` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=8 -alter table innodb_compressed row_format=default page_compressed=1 page_compression_level=8 key_block_size=0; -show warnings; -Level Code Message -show create table innodb_compressed; -Table Create Table -innodb_compressed CREATE TABLE `innodb_compressed` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=8 -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -select count(*) from innodb_compressed; -count(*) -5000 -select count(*) from innodb_page_compressed1; -count(*) -5000 -select count(*) from innodb_page_compressed1 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed2 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed3 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed4 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed5 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed6 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed7 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed8 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed9 where c1 < 500000; -count(*) -5000 -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -select count(*) from innodb_compressed; -count(*) -5000 -select count(*) from innodb_page_compressed1; -count(*) -5000 -select count(*) from innodb_page_compressed1 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed2 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed3 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed4 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed5 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed6 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed7 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed8 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed9 where c1 < 500000; -count(*) -5000 -set global innodb_compression_algorithm = 1; -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -commit; -select count(*) from innodb_compressed; -count(*) -5000 -select count(*) from innodb_page_compressed1; -count(*) -5000 -select count(*) from innodb_page_compressed1 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed2 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed3 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed4 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed5 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed6 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed7 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed8 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed9 where c1 < 500000; -count(*) -5000 -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -select count(*) from innodb_compressed; -count(*) -5000 -select count(*) from innodb_page_compressed1; -count(*) -5000 -select count(*) from innodb_page_compressed1 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed2 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed3 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed4 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed5 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed6 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed7 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed8 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed9 where c1 < 500000; -count(*) -5000 -set global innodb_compression_algorithm = 0; -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -commit; -select count(*) from innodb_compressed; -count(*) -5000 -select count(*) from innodb_page_compressed1; -count(*) -5000 -select count(*) from innodb_page_compressed1 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed2 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed3 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed4 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed5 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed6 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed7 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed8 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed9 where c1 < 500000; -count(*) -5000 -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -select count(*) from innodb_compressed; -count(*) -5000 -select count(*) from innodb_page_compressed1; -count(*) -5000 -select count(*) from innodb_page_compressed1 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed2 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed3 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed4 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed5 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed6 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed7 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed8 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed9 where c1 < 500000; -count(*) -5000 -drop procedure innodb_insert_proc; -drop table innodb_normal; -drop table innodb_compressed; -drop table innodb_page_compressed1; -drop table innodb_page_compressed2; -drop table innodb_page_compressed3; -drop table innodb_page_compressed4; -drop table innodb_page_compressed5; -drop table innodb_page_compressed6; -drop table innodb_page_compressed7; -drop table innodb_page_compressed8; -drop table innodb_page_compressed9; +set global innodb_compression_algorithm = bzip2; +select @@innodb_compression_algorithm; +@@innodb_compression_algorithm +bzip2 +set global innodb_file_format = `Barracuda`; +set global innodb_file_per_table = on; +call mtr.add_suppression("InnoDB: Database page corruption on disk or a failed file read of tablespace test/t[0-9]+ page \\[page id: space=[0-9]+, page number=[0-9]+\\]. You may have to recover from a backup."); +call mtr.add_suppression("InnoDB: Page \\[page id: space=[0-9]+, page number= [0-9]+\\] in file ./test/t[0-9]+.ibd may be corrupted. Post compression checksum [0-9]+ stored [0-9]+ compression_method [ZLIB|SNAPPY|LZ4|LZO|LZMA|BZIP2]"); +call mtr.add_suppression("InnoDB: Background Page read failed to read or decrypt \\[page id: space=[0-9]+, page number=[0-9]+\\]"); +call mtr.add_suppression("mysqld: Index for table 't[0-9]+' is corrupt; try to repair it"); +create table t0 (c1 int not null auto_increment primary key, b char(200)) engine=innodb; +create table t1 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=1; +create table t2 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=2; +create table t3 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=3; +create table t4 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=4; +create table t5 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=5; +create table t6 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=6; +create table t7 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=7; +create table t8 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=8; +create table t9 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=9; +select count(*) from t1; +count(*) +500 +select count(*) from t3; +count(*) +500 +select count(*) from t4; +count(*) +500 +select count(*) from t5; +count(*) +500 +select count(*) from t6; +count(*) +500 +select count(*) from t6; +count(*) +500 +select count(*) from t7; +count(*) +500 +select count(*) from t8; +count(*) +500 +select count(*) from t9; +count(*) +500 +# t0 expected FOUND +FOUND 1284 /AaAaAaAa/ in t0.ibd +# t1 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t1.ibd +# t2 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t2.ibd +# t3 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t3.ibd +# t4 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t4.ibd +# t5 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t5.ibd +# t6 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t6.ibd +# t7 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t7.ibd +# t8 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t8.ibd +# t9 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t9.ibd +# Run innochecksum on t9 +# Run innochecksum on t8 +# Run innochecksum on t7 +# Run innochecksum on t6 +# Run innochecksum on t5 +# Run innochecksum on t4 +# Run innochecksum on t3 +# Run innochecksum on t2 +# Run innochecksum on t1 +select count(*) from t0; +count(*) +500 +select count(*) from t1; +count(*) +500 +select count(*) from t3; +count(*) +500 +select count(*) from t4; +count(*) +500 +select count(*) from t5; +count(*) +500 +select count(*) from t6; +count(*) +500 +select count(*) from t7; +count(*) +500 +select count(*) from t8; +count(*) +500 +select count(*) from t9; +count(*) +500 +# Restart server +# Corrupting tablespaces... +# Corruption done +# Run innochecksum on t4 +# Run innochecksum on t3 +# Run innochecksum on t2 +# Run innochecksum on t1 +# Start server again +select * from t1; +ERROR HY000: Index for table 't1' is corrupt; try to repair it +select * from t2; +ERROR HY000: Index for table 't2' is corrupt; try to repair it +select * from t3; +ERROR HY000: Index for table 't3' is corrupt; try to repair it +select * from t4; +ERROR HY000: Index for table 't4' is corrupt; try to repair it +select count(*) from t5; +count(*) +500 +select count(*) from t6; +count(*) +500 +select count(*) from t7; +count(*) +500 +select count(*) from t8; +count(*) +500 +select count(*) from t9; +count(*) +500 +drop table t0, t1, t2, t3, t4, t5, t6, t7, t8, t9; +#done diff --git a/mysql-test/suite/innodb/r/innodb-page_compression_default.result b/mysql-test/suite/innodb/r/innodb-page_compression_default.result index 413450e1a6d..be2df0a429a 100644 --- a/mysql-test/suite/innodb/r/innodb-page_compression_default.result +++ b/mysql-test/suite/innodb/r/innodb-page_compression_default.result @@ -1,98 +1,133 @@ call mtr.add_suppression("InnoDB: Compression failed for space [0-9]+ name test/innodb_page_compressed[0-9] len [0-9]+ err 2 write_size [0-9]+."); set global innodb_file_format = `Barracuda`; set global innodb_file_per_table = on; -create table innodb_normal (c1 int not null auto_increment primary key, b char(200)) engine=innodb; -create table innodb_page_compressed1 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=1; -create table innodb_page_compressed2 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=2; -create table innodb_page_compressed3 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=3; -create table innodb_page_compressed4 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=4; -create table innodb_page_compressed5 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=5; -create table innodb_page_compressed6 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=6; -create table innodb_page_compressed7 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=7; -create table innodb_page_compressed8 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=8; -create table innodb_page_compressed9 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=9; -select count(*) from innodb_page_compressed1; -count(*) -10000 -select count(*) from innodb_page_compressed3; -count(*) -10000 -select count(*) from innodb_page_compressed4; -count(*) -10000 -select count(*) from innodb_page_compressed5; -count(*) -10000 -select count(*) from innodb_page_compressed6; -count(*) -10000 -select count(*) from innodb_page_compressed6; -count(*) -10000 -select count(*) from innodb_page_compressed7; -count(*) -10000 -select count(*) from innodb_page_compressed8; -count(*) -10000 -select count(*) from innodb_page_compressed9; -count(*) -10000 -# innodb_normal expected FOUND -FOUND 24084 /AaAaAaAa/ in innodb_normal.ibd -# innodb_page_compressed1 page compressed expected NOT FOUND -NOT FOUND /AaAaAaAa/ in innodb_page_compressed1.ibd -# innodb_page_compressed2 page compressed expected NOT FOUND -NOT FOUND /AaAaAaAa/ in innodb_page_compressed2.ibd -# innodb_page_compressed3 page compressed expected NOT FOUND -NOT FOUND /AaAaAaAa/ in innodb_page_compressed3.ibd -# innodb_page_compressed4 page compressed expected NOT FOUND -NOT FOUND /AaAaAaAa/ in innodb_page_compressed4.ibd -# innodb_page_compressed5 page compressed expected NOT FOUND -NOT FOUND /AaAaAaAa/ in innodb_page_compressed5.ibd -# innodb_page_compressed6 page compressed expected NOT FOUND -NOT FOUND /AaAaAaAa/ in innodb_page_compressed6.ibd -# innodb_page_compressed7 page compressed expected NOT FOUND -NOT FOUND /AaAaAaAa/ in innodb_page_compressed7.ibd -# innodb_page_compressed8 page compressed expected NOT FOUND -NOT FOUND /AaAaAaAa/ in innodb_page_compressed8.ibd -# innodb_page_compressed9 page compressed expected NOT FOUND -NOT FOUND /AaAaAaAa/ in innodb_page_compressed9.ibd -select count(*) from innodb_page_compressed1; -count(*) -10000 -select count(*) from innodb_page_compressed3; -count(*) -10000 -select count(*) from innodb_page_compressed4; -count(*) -10000 -select count(*) from innodb_page_compressed5; -count(*) -10000 -select count(*) from innodb_page_compressed6; -count(*) -10000 -select count(*) from innodb_page_compressed6; -count(*) -10000 -select count(*) from innodb_page_compressed7; -count(*) -10000 -select count(*) from innodb_page_compressed8; -count(*) -10000 -select count(*) from innodb_page_compressed9; -count(*) -10000 -drop table innodb_normal; -drop table innodb_page_compressed1; -drop table innodb_page_compressed2; -drop table innodb_page_compressed3; -drop table innodb_page_compressed4; -drop table innodb_page_compressed5; -drop table innodb_page_compressed6; -drop table innodb_page_compressed7; -drop table innodb_page_compressed8; -drop table innodb_page_compressed9; +call mtr.add_suppression("InnoDB: Database page corruption on disk or a failed file read of tablespace test/t[0-9]+ page \\[page id: space=[0-9]+, page number=[0-9]+\\]. You may have to recover from a backup."); +call mtr.add_suppression("InnoDB: Page \\[page id: space=[0-9]+, page number= [0-9]+\\] in file ./test/t[0-9]+.ibd may be corrupted. Post compression checksum [0-9]+ stored [0-9]+ compression_method [ZLIB|SNAPPY|LZ4|LZO|LZMA|BZIP2]"); +call mtr.add_suppression("InnoDB: Background Page read failed to read or decrypt \\[page id: space=[0-9]+, page number=[0-9]+\\]"); +call mtr.add_suppression("mysqld: Index for table 't[0-9]+' is corrupt; try to repair it"); +create table t0 (c1 int not null auto_increment primary key, b char(200)) engine=innodb; +create table t1 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=1; +create table t2 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=2; +create table t3 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=3; +create table t4 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=4; +create table t5 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=5; +create table t6 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=6; +create table t7 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=7; +create table t8 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=8; +create table t9 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=9; +select count(*) from t1; +count(*) +500 +select count(*) from t3; +count(*) +500 +select count(*) from t4; +count(*) +500 +select count(*) from t5; +count(*) +500 +select count(*) from t6; +count(*) +500 +select count(*) from t6; +count(*) +500 +select count(*) from t7; +count(*) +500 +select count(*) from t8; +count(*) +500 +select count(*) from t9; +count(*) +500 +# t0 expected FOUND +FOUND 1284 /AaAaAaAa/ in t0.ibd +# t1 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t1.ibd +# t2 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t2.ibd +# t3 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t3.ibd +# t4 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t4.ibd +# t5 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t5.ibd +# t6 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t6.ibd +# t7 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t7.ibd +# t8 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t8.ibd +# t9 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t9.ibd +# Run innochecksum on t9 +# Run innochecksum on t8 +# Run innochecksum on t7 +# Run innochecksum on t6 +# Run innochecksum on t5 +# Run innochecksum on t4 +# Run innochecksum on t3 +# Run innochecksum on t2 +# Run innochecksum on t1 +select count(*) from t0; +count(*) +500 +select count(*) from t1; +count(*) +500 +select count(*) from t3; +count(*) +500 +select count(*) from t4; +count(*) +500 +select count(*) from t5; +count(*) +500 +select count(*) from t6; +count(*) +500 +select count(*) from t7; +count(*) +500 +select count(*) from t8; +count(*) +500 +select count(*) from t9; +count(*) +500 +# Restart server +# Corrupting tablespaces... +# Corruption done +# Run innochecksum on t4 +# Run innochecksum on t3 +# Run innochecksum on t2 +# Run innochecksum on t1 +# Start server again +select * from t1; +ERROR HY000: Index for table 't1' is corrupt; try to repair it +select * from t2; +ERROR HY000: Index for table 't2' is corrupt; try to repair it +select * from t3; +ERROR HY000: Index for table 't3' is corrupt; try to repair it +select * from t4; +ERROR HY000: Index for table 't4' is corrupt; try to repair it +select count(*) from t5; +count(*) +500 +select count(*) from t6; +count(*) +500 +select count(*) from t7; +count(*) +500 +select count(*) from t8; +count(*) +500 +select count(*) from t9; +count(*) +500 +drop table t0, t1, t2, t3, t4, t5, t6, t7, t8, t9; #done diff --git a/mysql-test/suite/innodb/r/innodb-page_compression_lz4.result b/mysql-test/suite/innodb/r/innodb-page_compression_lz4.result index 6cef1978ca0..da57b20bdb4 100644 --- a/mysql-test/suite/innodb/r/innodb-page_compression_lz4.result +++ b/mysql-test/suite/innodb/r/innodb-page_compression_lz4.result @@ -1,436 +1,136 @@ -set global innodb_compression_algorithm = 2; -create table innodb_compressed(c1 int, b char(20)) engine=innodb row_format=compressed key_block_size=8; -show warnings; -Level Code Message -create table innodb_normal (c1 int, b char(20)) engine=innodb; -show warnings; -Level Code Message -create table innodb_page_compressed1 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=1; -show warnings; -Level Code Message -show create table innodb_page_compressed1; -Table Create Table -innodb_page_compressed1 CREATE TABLE `innodb_page_compressed1` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=1 -create table innodb_page_compressed2 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=2; -show warnings; -Level Code Message -show create table innodb_page_compressed2; -Table Create Table -innodb_page_compressed2 CREATE TABLE `innodb_page_compressed2` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=2 -create table innodb_page_compressed3 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=3; -show warnings; -Level Code Message -show create table innodb_page_compressed3; -Table Create Table -innodb_page_compressed3 CREATE TABLE `innodb_page_compressed3` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=3 -create table innodb_page_compressed4 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=4; -show warnings; -Level Code Message -show create table innodb_page_compressed4; -Table Create Table -innodb_page_compressed4 CREATE TABLE `innodb_page_compressed4` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=4 -create table innodb_page_compressed5 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=5; -show warnings; -Level Code Message -show create table innodb_page_compressed5; -Table Create Table -innodb_page_compressed5 CREATE TABLE `innodb_page_compressed5` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=5 -create table innodb_page_compressed6 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=6; -show warnings; -Level Code Message -show create table innodb_page_compressed6; -Table Create Table -innodb_page_compressed6 CREATE TABLE `innodb_page_compressed6` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=6 -create table innodb_page_compressed7 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=7; -show warnings; -Level Code Message -show create table innodb_page_compressed7; -Table Create Table -innodb_page_compressed7 CREATE TABLE `innodb_page_compressed7` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=7 -create table innodb_page_compressed8 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=8; -show warnings; -Level Code Message -show create table innodb_page_compressed8; -Table Create Table -innodb_page_compressed8 CREATE TABLE `innodb_page_compressed8` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=8 -create table innodb_page_compressed9 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=9; -show warnings; -Level Code Message -show create table innodb_page_compressed9; -Table Create Table -innodb_page_compressed9 CREATE TABLE `innodb_page_compressed9` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=9 -create procedure innodb_insert_proc (repeat_count int) -begin -declare current_num int; -set current_num = 0; -while current_num < repeat_count do -insert into innodb_normal values(current_num,'testing..'); -set current_num = current_num + 1; -end while; -end// -commit; -set autocommit=0; -call innodb_insert_proc(5000); -commit; -set autocommit=1; -select count(*) from innodb_normal; -count(*) -5000 -insert into innodb_compressed select * from innodb_normal; -insert into innodb_page_compressed1 select * from innodb_normal; -insert into innodb_page_compressed2 select * from innodb_normal; -insert into innodb_page_compressed3 select * from innodb_normal; -insert into innodb_page_compressed4 select * from innodb_normal; -insert into innodb_page_compressed5 select * from innodb_normal; -insert into innodb_page_compressed6 select * from innodb_normal; -insert into innodb_page_compressed7 select * from innodb_normal; -insert into innodb_page_compressed8 select * from innodb_normal; -insert into innodb_page_compressed9 select * from innodb_normal; -commit; -select count(*) from innodb_compressed; -count(*) -5000 -select count(*) from innodb_page_compressed1; -count(*) -5000 -select count(*) from innodb_page_compressed1 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed2 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed3 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed4 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed5 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed6 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed7 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed8 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed9 where c1 < 500000; -count(*) -5000 -alter table innodb_normal page_compressed=1 page_compression_level=8; -show warnings; -Level Code Message -show create table innodb_normal; -Table Create Table -innodb_normal CREATE TABLE `innodb_normal` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=8 -alter table innodb_compressed row_format=default page_compressed=1 page_compression_level=8 key_block_size=0; -show warnings; -Level Code Message -show create table innodb_compressed; -Table Create Table -innodb_compressed CREATE TABLE `innodb_compressed` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=8 -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -commit; -select count(*) from innodb_compressed; -count(*) -5000 -select count(*) from innodb_page_compressed1; -count(*) -5000 -select count(*) from innodb_page_compressed1 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed2 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed3 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed4 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed5 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed6 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed7 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed8 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed9 where c1 < 500000; -count(*) -5000 -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -select count(*) from innodb_compressed; -count(*) -5000 -select count(*) from innodb_page_compressed1; -count(*) -5000 -select count(*) from innodb_page_compressed1 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed2 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed3 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed4 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed5 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed6 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed7 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed8 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed9 where c1 < 500000; -count(*) -5000 -set global innodb_compression_algorithm = 1; -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -commit; -select count(*) from innodb_compressed; -count(*) -5000 -select count(*) from innodb_page_compressed1; -count(*) -5000 -select count(*) from innodb_page_compressed1 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed2 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed3 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed4 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed5 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed6 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed7 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed8 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed9 where c1 < 500000; -count(*) -5000 -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -select count(*) from innodb_compressed; -count(*) -5000 -select count(*) from innodb_page_compressed1; -count(*) -5000 -select count(*) from innodb_page_compressed1 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed2 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed3 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed4 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed5 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed6 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed7 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed8 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed9 where c1 < 500000; -count(*) -5000 -set global innodb_compression_algorithm = 0; -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -commit; -select count(*) from innodb_compressed; -count(*) -5000 -select count(*) from innodb_page_compressed1; -count(*) -5000 -select count(*) from innodb_page_compressed1 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed2 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed3 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed4 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed5 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed6 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed7 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed8 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed9 where c1 < 500000; -count(*) -5000 -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -select count(*) from innodb_compressed; -count(*) -5000 -select count(*) from innodb_page_compressed1; -count(*) -5000 -select count(*) from innodb_page_compressed1 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed2 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed3 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed4 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed5 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed6 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed7 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed8 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed9 where c1 < 500000; -count(*) -5000 -drop procedure innodb_insert_proc; -drop table innodb_normal; -drop table innodb_compressed; -drop table innodb_page_compressed1; -drop table innodb_page_compressed2; -drop table innodb_page_compressed3; -drop table innodb_page_compressed4; -drop table innodb_page_compressed5; -drop table innodb_page_compressed6; -drop table innodb_page_compressed7; -drop table innodb_page_compressed8; -drop table innodb_page_compressed9; +set global innodb_compression_algorithm = lz4; +select @@innodb_compression_algorithm; +@@innodb_compression_algorithm +lz4 +set global innodb_file_format = `Barracuda`; +set global innodb_file_per_table = on; +call mtr.add_suppression("InnoDB: Database page corruption on disk or a failed file read of tablespace test/t[0-9]+ page \\[page id: space=[0-9]+, page number=[0-9]+\\]. You may have to recover from a backup."); +call mtr.add_suppression("InnoDB: Page \\[page id: space=[0-9]+, page number= [0-9]+\\] in file ./test/t[0-9]+.ibd may be corrupted. Post compression checksum [0-9]+ stored [0-9]+ compression_method [ZLIB|SNAPPY|LZ4|LZO|LZMA|BZIP2]"); +call mtr.add_suppression("InnoDB: Background Page read failed to read or decrypt \\[page id: space=[0-9]+, page number=[0-9]+\\]"); +call mtr.add_suppression("mysqld: Index for table 't[0-9]+' is corrupt; try to repair it"); +create table t0 (c1 int not null auto_increment primary key, b char(200)) engine=innodb; +create table t1 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=1; +create table t2 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=2; +create table t3 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=3; +create table t4 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=4; +create table t5 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=5; +create table t6 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=6; +create table t7 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=7; +create table t8 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=8; +create table t9 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=9; +select count(*) from t1; +count(*) +500 +select count(*) from t3; +count(*) +500 +select count(*) from t4; +count(*) +500 +select count(*) from t5; +count(*) +500 +select count(*) from t6; +count(*) +500 +select count(*) from t6; +count(*) +500 +select count(*) from t7; +count(*) +500 +select count(*) from t8; +count(*) +500 +select count(*) from t9; +count(*) +500 +# t0 expected FOUND +FOUND 1284 /AaAaAaAa/ in t0.ibd +# t1 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t1.ibd +# t2 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t2.ibd +# t3 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t3.ibd +# t4 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t4.ibd +# t5 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t5.ibd +# t6 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t6.ibd +# t7 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t7.ibd +# t8 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t8.ibd +# t9 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t9.ibd +# Run innochecksum on t9 +# Run innochecksum on t8 +# Run innochecksum on t7 +# Run innochecksum on t6 +# Run innochecksum on t5 +# Run innochecksum on t4 +# Run innochecksum on t3 +# Run innochecksum on t2 +# Run innochecksum on t1 +select count(*) from t0; +count(*) +500 +select count(*) from t1; +count(*) +500 +select count(*) from t3; +count(*) +500 +select count(*) from t4; +count(*) +500 +select count(*) from t5; +count(*) +500 +select count(*) from t6; +count(*) +500 +select count(*) from t7; +count(*) +500 +select count(*) from t8; +count(*) +500 +select count(*) from t9; +count(*) +500 +# Restart server +# Corrupting tablespaces... +# Corruption done +# Run innochecksum on t4 +# Run innochecksum on t3 +# Run innochecksum on t2 +# Run innochecksum on t1 +# Start server again +select * from t1; +ERROR HY000: Index for table 't1' is corrupt; try to repair it +select * from t2; +ERROR HY000: Index for table 't2' is corrupt; try to repair it +select * from t3; +ERROR HY000: Index for table 't3' is corrupt; try to repair it +select * from t4; +ERROR HY000: Index for table 't4' is corrupt; try to repair it +select count(*) from t5; +count(*) +500 +select count(*) from t6; +count(*) +500 +select count(*) from t7; +count(*) +500 +select count(*) from t8; +count(*) +500 +select count(*) from t9; +count(*) +500 +drop table t0, t1, t2, t3, t4, t5, t6, t7, t8, t9; +#done diff --git a/mysql-test/suite/innodb/r/innodb-page_compression_lzma.result b/mysql-test/suite/innodb/r/innodb-page_compression_lzma.result index c7ab859e102..6d4e4e08dbe 100644 --- a/mysql-test/suite/innodb/r/innodb-page_compression_lzma.result +++ b/mysql-test/suite/innodb/r/innodb-page_compression_lzma.result @@ -1,435 +1,133 @@ -set global innodb_compression_algorithm = 4; -create table innodb_compressed(c1 int, b char(20)) engine=innodb row_format=compressed key_block_size=8; -show warnings; -Level Code Message -create table innodb_normal (c1 int, b char(20)) engine=innodb; -show warnings; -Level Code Message -create table innodb_page_compressed1 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=1; -show warnings; -Level Code Message -show create table innodb_page_compressed1; -Table Create Table -innodb_page_compressed1 CREATE TABLE `innodb_page_compressed1` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=1 -create table innodb_page_compressed2 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=2; -show warnings; -Level Code Message -show create table innodb_page_compressed2; -Table Create Table -innodb_page_compressed2 CREATE TABLE `innodb_page_compressed2` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=2 -create table innodb_page_compressed3 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=3; -show warnings; -Level Code Message -show create table innodb_page_compressed3; -Table Create Table -innodb_page_compressed3 CREATE TABLE `innodb_page_compressed3` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=3 -create table innodb_page_compressed4 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=4; -show warnings; -Level Code Message -show create table innodb_page_compressed4; -Table Create Table -innodb_page_compressed4 CREATE TABLE `innodb_page_compressed4` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=4 -create table innodb_page_compressed5 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=5; -show warnings; -Level Code Message -show create table innodb_page_compressed5; -Table Create Table -innodb_page_compressed5 CREATE TABLE `innodb_page_compressed5` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=5 -create table innodb_page_compressed6 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=6; -show warnings; -Level Code Message -show create table innodb_page_compressed6; -Table Create Table -innodb_page_compressed6 CREATE TABLE `innodb_page_compressed6` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=6 -create table innodb_page_compressed7 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=7; -show warnings; -Level Code Message -show create table innodb_page_compressed7; -Table Create Table -innodb_page_compressed7 CREATE TABLE `innodb_page_compressed7` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=7 -create table innodb_page_compressed8 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=8; -show warnings; -Level Code Message -show create table innodb_page_compressed8; -Table Create Table -innodb_page_compressed8 CREATE TABLE `innodb_page_compressed8` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=8 -create table innodb_page_compressed9 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=9; -show warnings; -Level Code Message -show create table innodb_page_compressed9; -Table Create Table -innodb_page_compressed9 CREATE TABLE `innodb_page_compressed9` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=9 -create procedure innodb_insert_proc (repeat_count int) -begin -declare current_num int; -set current_num = 0; -while current_num < repeat_count do -insert into innodb_normal values(current_num,'testing..'); -set current_num = current_num + 1; -end while; -end// -commit; -set autocommit=0; -call innodb_insert_proc(5000); -commit; -set autocommit=1; -select count(*) from innodb_normal; -count(*) -5000 -insert into innodb_compressed select * from innodb_normal; -insert into innodb_page_compressed1 select * from innodb_normal; -insert into innodb_page_compressed2 select * from innodb_normal; -insert into innodb_page_compressed3 select * from innodb_normal; -insert into innodb_page_compressed4 select * from innodb_normal; -insert into innodb_page_compressed5 select * from innodb_normal; -insert into innodb_page_compressed6 select * from innodb_normal; -insert into innodb_page_compressed7 select * from innodb_normal; -insert into innodb_page_compressed8 select * from innodb_normal; -insert into innodb_page_compressed9 select * from innodb_normal; -commit; -select count(*) from innodb_compressed; -count(*) -5000 -select count(*) from innodb_page_compressed1; -count(*) -5000 -select count(*) from innodb_page_compressed1 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed2 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed3 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed4 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed5 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed6 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed7 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed8 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed9 where c1 < 500000; -count(*) -5000 -alter table innodb_normal page_compressed=1 page_compression_level=8; -show warnings; -Level Code Message -show create table innodb_normal; -Table Create Table -innodb_normal CREATE TABLE `innodb_normal` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=8 -alter table innodb_compressed row_format=default page_compressed=1 page_compression_level=8 key_block_size=0; -show warnings; -Level Code Message -show create table innodb_compressed; -Table Create Table -innodb_compressed CREATE TABLE `innodb_compressed` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=8 -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -select count(*) from innodb_compressed; -count(*) -5000 -select count(*) from innodb_page_compressed1; -count(*) -5000 -select count(*) from innodb_page_compressed1 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed2 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed3 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed4 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed5 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed6 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed7 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed8 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed9 where c1 < 500000; -count(*) -5000 -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -select count(*) from innodb_compressed; -count(*) -5000 -select count(*) from innodb_page_compressed1; -count(*) -5000 -select count(*) from innodb_page_compressed1 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed2 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed3 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed4 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed5 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed6 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed7 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed8 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed9 where c1 < 500000; -count(*) -5000 -set global innodb_compression_algorithm = 1; -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -commit; -select count(*) from innodb_compressed; -count(*) -5000 -select count(*) from innodb_page_compressed1; -count(*) -5000 -select count(*) from innodb_page_compressed1 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed2 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed3 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed4 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed5 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed6 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed7 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed8 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed9 where c1 < 500000; -count(*) -5000 -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -select count(*) from innodb_compressed; -count(*) -5000 -select count(*) from innodb_page_compressed1; -count(*) -5000 -select count(*) from innodb_page_compressed1 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed2 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed3 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed4 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed5 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed6 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed7 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed8 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed9 where c1 < 500000; -count(*) -5000 -set global innodb_compression_algorithm = 0; -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -commit; -select count(*) from innodb_compressed; -count(*) -5000 -select count(*) from innodb_page_compressed1; -count(*) -5000 -select count(*) from innodb_page_compressed1 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed2 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed3 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed4 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed5 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed6 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed7 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed8 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed9 where c1 < 500000; -count(*) -5000 -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -select count(*) from innodb_compressed; -count(*) -5000 -select count(*) from innodb_page_compressed1; -count(*) -5000 -select count(*) from innodb_page_compressed1 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed2 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed3 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed4 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed5 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed6 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed7 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed8 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed9 where c1 < 500000; -count(*) -5000 -drop procedure innodb_insert_proc; -drop table innodb_normal; -drop table innodb_compressed; -drop table innodb_page_compressed1; -drop table innodb_page_compressed2; -drop table innodb_page_compressed3; -drop table innodb_page_compressed4; -drop table innodb_page_compressed5; -drop table innodb_page_compressed6; -drop table innodb_page_compressed7; -drop table innodb_page_compressed8; -drop table innodb_page_compressed9; +set global innodb_compression_algorithm = lzma; +set global innodb_file_format = `Barracuda`; +set global innodb_file_per_table = on; +call mtr.add_suppression("InnoDB: Database page corruption on disk or a failed file read of tablespace test/t[0-9]+ page \\[page id: space=[0-9]+, page number=[0-9]+\\]. You may have to recover from a backup."); +call mtr.add_suppression("InnoDB: Page \\[page id: space=[0-9]+, page number= [0-9]+\\] in file ./test/t[0-9]+.ibd may be corrupted. Post compression checksum [0-9]+ stored [0-9]+ compression_method [ZLIB|SNAPPY|LZ4|LZO|LZMA|BZIP2]"); +call mtr.add_suppression("InnoDB: Background Page read failed to read or decrypt \\[page id: space=[0-9]+, page number=[0-9]+\\]"); +call mtr.add_suppression("mysqld: Index for table 't[0-9]+' is corrupt; try to repair it"); +create table t0 (c1 int not null auto_increment primary key, b char(200)) engine=innodb; +create table t1 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=1; +create table t2 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=2; +create table t3 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=3; +create table t4 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=4; +create table t5 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=5; +create table t6 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=6; +create table t7 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=7; +create table t8 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=8; +create table t9 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=9; +select count(*) from t1; +count(*) +500 +select count(*) from t3; +count(*) +500 +select count(*) from t4; +count(*) +500 +select count(*) from t5; +count(*) +500 +select count(*) from t6; +count(*) +500 +select count(*) from t6; +count(*) +500 +select count(*) from t7; +count(*) +500 +select count(*) from t8; +count(*) +500 +select count(*) from t9; +count(*) +500 +# t0 expected FOUND +FOUND 1284 /AaAaAaAa/ in t0.ibd +# t1 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t1.ibd +# t2 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t2.ibd +# t3 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t3.ibd +# t4 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t4.ibd +# t5 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t5.ibd +# t6 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t6.ibd +# t7 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t7.ibd +# t8 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t8.ibd +# t9 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t9.ibd +# Run innochecksum on t9 +# Run innochecksum on t8 +# Run innochecksum on t7 +# Run innochecksum on t6 +# Run innochecksum on t5 +# Run innochecksum on t4 +# Run innochecksum on t3 +# Run innochecksum on t2 +# Run innochecksum on t1 +select count(*) from t0; +count(*) +500 +select count(*) from t1; +count(*) +500 +select count(*) from t3; +count(*) +500 +select count(*) from t4; +count(*) +500 +select count(*) from t5; +count(*) +500 +select count(*) from t6; +count(*) +500 +select count(*) from t7; +count(*) +500 +select count(*) from t8; +count(*) +500 +select count(*) from t9; +count(*) +500 +# Restart server +# Corrupting tablespaces... +# Corruption done +# Run innochecksum on t4 +# Run innochecksum on t3 +# Run innochecksum on t2 +# Run innochecksum on t1 +# Start server again +select * from t1; +ERROR HY000: Index for table 't1' is corrupt; try to repair it +select * from t2; +ERROR HY000: Index for table 't2' is corrupt; try to repair it +select * from t3; +ERROR HY000: Index for table 't3' is corrupt; try to repair it +select * from t4; +ERROR HY000: Index for table 't4' is corrupt; try to repair it +select count(*) from t5; +count(*) +500 +select count(*) from t6; +count(*) +500 +select count(*) from t7; +count(*) +500 +select count(*) from t8; +count(*) +500 +select count(*) from t9; +count(*) +500 +drop table t0, t1, t2, t3, t4, t5, t6, t7, t8, t9; +#done diff --git a/mysql-test/suite/innodb/r/innodb-page_compression_lzo.result b/mysql-test/suite/innodb/r/innodb-page_compression_lzo.result index 379abcc9968..4b4f1949c25 100644 --- a/mysql-test/suite/innodb/r/innodb-page_compression_lzo.result +++ b/mysql-test/suite/innodb/r/innodb-page_compression_lzo.result @@ -1,349 +1,136 @@ -set global innodb_compression_algorithm = 3; -create table innodb_compressed(c1 int, b char(20)) engine=innodb row_format=compressed key_block_size=8; -show warnings; -Level Code Message -create table innodb_normal (c1 int, b char(20)) engine=innodb; -show warnings; -Level Code Message -create table innodb_page_compressed1 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=1; -show warnings; -Level Code Message -show create table innodb_page_compressed1; -Table Create Table -innodb_page_compressed1 CREATE TABLE `innodb_page_compressed1` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=1 -create table innodb_page_compressed2 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=2; -show warnings; -Level Code Message -show create table innodb_page_compressed2; -Table Create Table -innodb_page_compressed2 CREATE TABLE `innodb_page_compressed2` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=2 -create table innodb_page_compressed3 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=3; -show warnings; -Level Code Message -show create table innodb_page_compressed3; -Table Create Table -innodb_page_compressed3 CREATE TABLE `innodb_page_compressed3` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=3 -create table innodb_page_compressed4 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=4; -show warnings; -Level Code Message -show create table innodb_page_compressed4; -Table Create Table -innodb_page_compressed4 CREATE TABLE `innodb_page_compressed4` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=4 -create table innodb_page_compressed5 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=5; -show warnings; -Level Code Message -show create table innodb_page_compressed5; -Table Create Table -innodb_page_compressed5 CREATE TABLE `innodb_page_compressed5` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=5 -create table innodb_page_compressed6 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=6; -show warnings; -Level Code Message -show create table innodb_page_compressed6; -Table Create Table -innodb_page_compressed6 CREATE TABLE `innodb_page_compressed6` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=6 -create table innodb_page_compressed7 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=7; -show warnings; -Level Code Message -show create table innodb_page_compressed7; -Table Create Table -innodb_page_compressed7 CREATE TABLE `innodb_page_compressed7` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=7 -create table innodb_page_compressed8 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=8; -show warnings; -Level Code Message -show create table innodb_page_compressed8; -Table Create Table -innodb_page_compressed8 CREATE TABLE `innodb_page_compressed8` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=8 -create table innodb_page_compressed9 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=9; -show warnings; -Level Code Message -show create table innodb_page_compressed9; -Table Create Table -innodb_page_compressed9 CREATE TABLE `innodb_page_compressed9` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=9 -create procedure innodb_insert_proc (repeat_count int) -begin -declare current_num int; -set current_num = 0; -while current_num < repeat_count do -insert into innodb_normal values(current_num,'testing..'); -set current_num = current_num + 1; -end while; -end// -commit; -set autocommit=0; -call innodb_insert_proc(5000); -commit; -set autocommit=1; -select count(*) from innodb_normal; -count(*) -5000 -insert into innodb_compressed select * from innodb_normal; -insert into innodb_page_compressed1 select * from innodb_normal; -insert into innodb_page_compressed2 select * from innodb_normal; -insert into innodb_page_compressed3 select * from innodb_normal; -insert into innodb_page_compressed4 select * from innodb_normal; -insert into innodb_page_compressed5 select * from innodb_normal; -insert into innodb_page_compressed6 select * from innodb_normal; -insert into innodb_page_compressed7 select * from innodb_normal; -insert into innodb_page_compressed8 select * from innodb_normal; -insert into innodb_page_compressed9 select * from innodb_normal; -commit; -select count(*) from innodb_compressed; -count(*) -5000 -select count(*) from innodb_page_compressed1; -count(*) -5000 -select count(*) from innodb_page_compressed1 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed2 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed3 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed4 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed5 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed6 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed7 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed8 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed9 where c1 < 500000; -count(*) -5000 -alter table innodb_normal page_compressed=1 page_compression_level=8; -show warnings; -Level Code Message -show create table innodb_normal; -Table Create Table -innodb_normal CREATE TABLE `innodb_normal` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=8 -alter table innodb_compressed row_format=default page_compressed=1 page_compression_level=8 key_block_size=0; -show warnings; -Level Code Message -show create table innodb_compressed; -Table Create Table -innodb_compressed CREATE TABLE `innodb_compressed` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=8 -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -select count(*) from innodb_compressed; -count(*) -5000 -select count(*) from innodb_page_compressed1; -count(*) -5000 -select count(*) from innodb_page_compressed1 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed2 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed3 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed4 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed5 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed6 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed7 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed8 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed9 where c1 < 500000; -count(*) -5000 -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -select count(*) from innodb_compressed; -count(*) -5000 -select count(*) from innodb_page_compressed1; -count(*) -5000 -select count(*) from innodb_page_compressed1 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed2 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed3 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed4 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed5 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed6 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed7 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed8 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed9 where c1 < 500000; -count(*) -5000 -set global innodb_compression_algorithm = 1; -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -commit; -select count(*) from innodb_compressed; -count(*) -5000 -select count(*) from innodb_page_compressed1; -count(*) -5000 -select count(*) from innodb_page_compressed1 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed2 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed3 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed4 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed5 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed6 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed7 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed8 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed9 where c1 < 500000; -count(*) -5000 -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -select count(*) from innodb_compressed; -count(*) -5000 -select count(*) from innodb_page_compressed1; -count(*) -5000 -select count(*) from innodb_page_compressed1 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed2 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed3 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed4 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed5 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed6 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed7 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed8 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed9 where c1 < 500000; -count(*) -5000 -drop procedure innodb_insert_proc; -drop table innodb_normal; -drop table innodb_compressed; -drop table innodb_page_compressed1; -drop table innodb_page_compressed2; -drop table innodb_page_compressed3; -drop table innodb_page_compressed4; -drop table innodb_page_compressed5; -drop table innodb_page_compressed6; -drop table innodb_page_compressed7; -drop table innodb_page_compressed8; -drop table innodb_page_compressed9; +set global innodb_compression_algorithm = lzo; +select @@innodb_compression_algorithm; +@@innodb_compression_algorithm +lzo +set global innodb_file_format = `Barracuda`; +set global innodb_file_per_table = on; +call mtr.add_suppression("InnoDB: Database page corruption on disk or a failed file read of tablespace test/t[0-9]+ page \\[page id: space=[0-9]+, page number=[0-9]+\\]. You may have to recover from a backup."); +call mtr.add_suppression("InnoDB: Page \\[page id: space=[0-9]+, page number= [0-9]+\\] in file ./test/t[0-9]+.ibd may be corrupted. Post compression checksum [0-9]+ stored [0-9]+ compression_method [ZLIB|SNAPPY|LZ4|LZO|LZMA|BZIP2]"); +call mtr.add_suppression("InnoDB: Background Page read failed to read or decrypt \\[page id: space=[0-9]+, page number=[0-9]+\\]"); +call mtr.add_suppression("mysqld: Index for table 't[0-9]+' is corrupt; try to repair it"); +create table t0 (c1 int not null auto_increment primary key, b char(200)) engine=innodb; +create table t1 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=1; +create table t2 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=2; +create table t3 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=3; +create table t4 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=4; +create table t5 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=5; +create table t6 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=6; +create table t7 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=7; +create table t8 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=8; +create table t9 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=9; +select count(*) from t1; +count(*) +500 +select count(*) from t3; +count(*) +500 +select count(*) from t4; +count(*) +500 +select count(*) from t5; +count(*) +500 +select count(*) from t6; +count(*) +500 +select count(*) from t6; +count(*) +500 +select count(*) from t7; +count(*) +500 +select count(*) from t8; +count(*) +500 +select count(*) from t9; +count(*) +500 +# t0 expected FOUND +FOUND 1284 /AaAaAaAa/ in t0.ibd +# t1 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t1.ibd +# t2 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t2.ibd +# t3 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t3.ibd +# t4 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t4.ibd +# t5 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t5.ibd +# t6 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t6.ibd +# t7 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t7.ibd +# t8 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t8.ibd +# t9 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t9.ibd +# Run innochecksum on t9 +# Run innochecksum on t8 +# Run innochecksum on t7 +# Run innochecksum on t6 +# Run innochecksum on t5 +# Run innochecksum on t4 +# Run innochecksum on t3 +# Run innochecksum on t2 +# Run innochecksum on t1 +select count(*) from t0; +count(*) +500 +select count(*) from t1; +count(*) +500 +select count(*) from t3; +count(*) +500 +select count(*) from t4; +count(*) +500 +select count(*) from t5; +count(*) +500 +select count(*) from t6; +count(*) +500 +select count(*) from t7; +count(*) +500 +select count(*) from t8; +count(*) +500 +select count(*) from t9; +count(*) +500 +# Restart server +# Corrupting tablespaces... +# Corruption done +# Run innochecksum on t4 +# Run innochecksum on t3 +# Run innochecksum on t2 +# Run innochecksum on t1 +# Start server again +select * from t1; +ERROR HY000: Index for table 't1' is corrupt; try to repair it +select * from t2; +ERROR HY000: Index for table 't2' is corrupt; try to repair it +select * from t3; +ERROR HY000: Index for table 't3' is corrupt; try to repair it +select * from t4; +ERROR HY000: Index for table 't4' is corrupt; try to repair it +select count(*) from t5; +count(*) +500 +select count(*) from t6; +count(*) +500 +select count(*) from t7; +count(*) +500 +select count(*) from t8; +count(*) +500 +select count(*) from t9; +count(*) +500 +drop table t0, t1, t2, t3, t4, t5, t6, t7, t8, t9; +#done diff --git a/mysql-test/suite/innodb/r/innodb-page_compression_snappy.result b/mysql-test/suite/innodb/r/innodb-page_compression_snappy.result index 83a17f678e4..bda7953b7df 100644 --- a/mysql-test/suite/innodb/r/innodb-page_compression_snappy.result +++ b/mysql-test/suite/innodb/r/innodb-page_compression_snappy.result @@ -1,99 +1,137 @@ call mtr.add_suppression("InnoDB: Compression failed for space [0-9]+ name test/innodb_page_compressed[0-9] len [0-9]+ err 2 write_size [0-9]+."); set global innodb_compression_algorithm = snappy; +select @@innodb_compression_algorithm; +@@innodb_compression_algorithm +snappy set global innodb_file_format = `Barracuda`; set global innodb_file_per_table = on; -create table innodb_normal (c1 int not null auto_increment primary key, b char(200)) engine=innodb; -create table innodb_page_compressed1 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=1; -create table innodb_page_compressed2 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=2; -create table innodb_page_compressed3 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=3; -create table innodb_page_compressed4 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=4; -create table innodb_page_compressed5 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=5; -create table innodb_page_compressed6 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=6; -create table innodb_page_compressed7 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=7; -create table innodb_page_compressed8 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=8; -create table innodb_page_compressed9 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=9; -select count(*) from innodb_page_compressed1; -count(*) -10000 -select count(*) from innodb_page_compressed3; -count(*) -10000 -select count(*) from innodb_page_compressed4; -count(*) -10000 -select count(*) from innodb_page_compressed5; -count(*) -10000 -select count(*) from innodb_page_compressed6; -count(*) -10000 -select count(*) from innodb_page_compressed6; -count(*) -10000 -select count(*) from innodb_page_compressed7; -count(*) -10000 -select count(*) from innodb_page_compressed8; -count(*) -10000 -select count(*) from innodb_page_compressed9; -count(*) -10000 -# innodb_normal expected FOUND -FOUND 24084 /AaAaAaAa/ in innodb_normal.ibd -# innodb_page_compressed1 page compressed expected NOT FOUND -NOT FOUND /AaAaAaAa/ in innodb_page_compressed1.ibd -# innodb_page_compressed2 page compressed expected NOT FOUND -NOT FOUND /AaAaAaAa/ in innodb_page_compressed2.ibd -# innodb_page_compressed3 page compressed expected NOT FOUND -NOT FOUND /AaAaAaAa/ in innodb_page_compressed3.ibd -# innodb_page_compressed4 page compressed expected NOT FOUND -NOT FOUND /AaAaAaAa/ in innodb_page_compressed4.ibd -# innodb_page_compressed5 page compressed expected NOT FOUND -NOT FOUND /AaAaAaAa/ in innodb_page_compressed5.ibd -# innodb_page_compressed6 page compressed expected NOT FOUND -NOT FOUND /AaAaAaAa/ in innodb_page_compressed6.ibd -# innodb_page_compressed7 page compressed expected NOT FOUND -NOT FOUND /AaAaAaAa/ in innodb_page_compressed7.ibd -# innodb_page_compressed8 page compressed expected NOT FOUND -NOT FOUND /AaAaAaAa/ in innodb_page_compressed8.ibd -# innodb_page_compressed9 page compressed expected NOT FOUND -NOT FOUND /AaAaAaAa/ in innodb_page_compressed9.ibd -select count(*) from innodb_page_compressed1; -count(*) -10000 -select count(*) from innodb_page_compressed3; -count(*) -10000 -select count(*) from innodb_page_compressed4; -count(*) -10000 -select count(*) from innodb_page_compressed5; -count(*) -10000 -select count(*) from innodb_page_compressed6; -count(*) -10000 -select count(*) from innodb_page_compressed6; -count(*) -10000 -select count(*) from innodb_page_compressed7; -count(*) -10000 -select count(*) from innodb_page_compressed8; -count(*) -10000 -select count(*) from innodb_page_compressed9; -count(*) -10000 -drop table innodb_normal; -drop table innodb_page_compressed1; -drop table innodb_page_compressed2; -drop table innodb_page_compressed3; -drop table innodb_page_compressed4; -drop table innodb_page_compressed5; -drop table innodb_page_compressed6; -drop table innodb_page_compressed7; -drop table innodb_page_compressed8; -drop table innodb_page_compressed9; +call mtr.add_suppression("InnoDB: Database page corruption on disk or a failed file read of tablespace test/t[0-9]+ page \\[page id: space=[0-9]+, page number=[0-9]+\\]. You may have to recover from a backup."); +call mtr.add_suppression("InnoDB: Page \\[page id: space=[0-9]+, page number= [0-9]+\\] in file ./test/t[0-9]+.ibd may be corrupted. Post compression checksum [0-9]+ stored [0-9]+ compression_method [ZLIB|SNAPPY|LZ4|LZO|LZMA|BZIP2]"); +call mtr.add_suppression("InnoDB: Background Page read failed to read or decrypt \\[page id: space=[0-9]+, page number=[0-9]+\\]"); +call mtr.add_suppression("mysqld: Index for table 't[0-9]+' is corrupt; try to repair it"); +create table t0 (c1 int not null auto_increment primary key, b char(200)) engine=innodb; +create table t1 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=1; +create table t2 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=2; +create table t3 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=3; +create table t4 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=4; +create table t5 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=5; +create table t6 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=6; +create table t7 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=7; +create table t8 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=8; +create table t9 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=9; +select count(*) from t1; +count(*) +500 +select count(*) from t3; +count(*) +500 +select count(*) from t4; +count(*) +500 +select count(*) from t5; +count(*) +500 +select count(*) from t6; +count(*) +500 +select count(*) from t6; +count(*) +500 +select count(*) from t7; +count(*) +500 +select count(*) from t8; +count(*) +500 +select count(*) from t9; +count(*) +500 +# t0 expected FOUND +FOUND 1284 /AaAaAaAa/ in t0.ibd +# t1 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t1.ibd +# t2 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t2.ibd +# t3 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t3.ibd +# t4 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t4.ibd +# t5 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t5.ibd +# t6 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t6.ibd +# t7 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t7.ibd +# t8 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t8.ibd +# t9 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t9.ibd +# Run innochecksum on t9 +# Run innochecksum on t8 +# Run innochecksum on t7 +# Run innochecksum on t6 +# Run innochecksum on t5 +# Run innochecksum on t4 +# Run innochecksum on t3 +# Run innochecksum on t2 +# Run innochecksum on t1 +select count(*) from t0; +count(*) +500 +select count(*) from t1; +count(*) +500 +select count(*) from t3; +count(*) +500 +select count(*) from t4; +count(*) +500 +select count(*) from t5; +count(*) +500 +select count(*) from t6; +count(*) +500 +select count(*) from t7; +count(*) +500 +select count(*) from t8; +count(*) +500 +select count(*) from t9; +count(*) +500 +# Restart server +# Corrupting tablespaces... +# Corruption done +# Run innochecksum on t4 +# Run innochecksum on t3 +# Run innochecksum on t2 +# Run innochecksum on t1 +# Start server again +select * from t1; +ERROR HY000: Index for table 't1' is corrupt; try to repair it +select * from t2; +ERROR HY000: Index for table 't2' is corrupt; try to repair it +select * from t3; +ERROR HY000: Index for table 't3' is corrupt; try to repair it +select * from t4; +ERROR HY000: Index for table 't4' is corrupt; try to repair it +select count(*) from t5; +count(*) +500 +select count(*) from t6; +count(*) +500 +select count(*) from t7; +count(*) +500 +select count(*) from t8; +count(*) +500 +select count(*) from t9; +count(*) +500 +drop table t0, t1, t2, t3, t4, t5, t6, t7, t8, t9; #done diff --git a/mysql-test/suite/innodb/r/innodb-page_compression_zip.result b/mysql-test/suite/innodb/r/innodb-page_compression_zip.result index bb9ceb29e17..638c8036468 100644 --- a/mysql-test/suite/innodb/r/innodb-page_compression_zip.result +++ b/mysql-test/suite/innodb/r/innodb-page_compression_zip.result @@ -1,349 +1,136 @@ -set global innodb_compression_algorithm = 1; -create table innodb_compressed(c1 int, b char(20)) engine=innodb row_format=compressed key_block_size=8; -show warnings; -Level Code Message -create table innodb_normal (c1 int, b char(20)) engine=innodb; -show warnings; -Level Code Message -create table innodb_page_compressed1 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=1; -show warnings; -Level Code Message -show create table innodb_page_compressed1; -Table Create Table -innodb_page_compressed1 CREATE TABLE `innodb_page_compressed1` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=1 -create table innodb_page_compressed2 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=2; -show warnings; -Level Code Message -show create table innodb_page_compressed2; -Table Create Table -innodb_page_compressed2 CREATE TABLE `innodb_page_compressed2` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=2 -create table innodb_page_compressed3 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=3; -show warnings; -Level Code Message -show create table innodb_page_compressed3; -Table Create Table -innodb_page_compressed3 CREATE TABLE `innodb_page_compressed3` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=3 -create table innodb_page_compressed4 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=4; -show warnings; -Level Code Message -show create table innodb_page_compressed4; -Table Create Table -innodb_page_compressed4 CREATE TABLE `innodb_page_compressed4` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=4 -create table innodb_page_compressed5 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=5; -show warnings; -Level Code Message -show create table innodb_page_compressed5; -Table Create Table -innodb_page_compressed5 CREATE TABLE `innodb_page_compressed5` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=5 -create table innodb_page_compressed6 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=6; -show warnings; -Level Code Message -show create table innodb_page_compressed6; -Table Create Table -innodb_page_compressed6 CREATE TABLE `innodb_page_compressed6` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=6 -create table innodb_page_compressed7 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=7; -show warnings; -Level Code Message -show create table innodb_page_compressed7; -Table Create Table -innodb_page_compressed7 CREATE TABLE `innodb_page_compressed7` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=7 -create table innodb_page_compressed8 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=8; -show warnings; -Level Code Message -show create table innodb_page_compressed8; -Table Create Table -innodb_page_compressed8 CREATE TABLE `innodb_page_compressed8` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=8 -create table innodb_page_compressed9 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=9; -show warnings; -Level Code Message -show create table innodb_page_compressed9; -Table Create Table -innodb_page_compressed9 CREATE TABLE `innodb_page_compressed9` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=9 -create procedure innodb_insert_proc (repeat_count int) -begin -declare current_num int; -set current_num = 0; -while current_num < repeat_count do -insert into innodb_normal values(current_num,'testing..'); -set current_num = current_num + 1; -end while; -end// -commit; -set autocommit=0; -call innodb_insert_proc(5000); -commit; -set autocommit=1; -select count(*) from innodb_normal; -count(*) -5000 -insert into innodb_compressed select * from innodb_normal; -insert into innodb_page_compressed1 select * from innodb_normal; -insert into innodb_page_compressed2 select * from innodb_normal; -insert into innodb_page_compressed3 select * from innodb_normal; -insert into innodb_page_compressed4 select * from innodb_normal; -insert into innodb_page_compressed5 select * from innodb_normal; -insert into innodb_page_compressed6 select * from innodb_normal; -insert into innodb_page_compressed7 select * from innodb_normal; -insert into innodb_page_compressed8 select * from innodb_normal; -insert into innodb_page_compressed9 select * from innodb_normal; -commit; -select count(*) from innodb_compressed; -count(*) -5000 -select count(*) from innodb_page_compressed1; -count(*) -5000 -select count(*) from innodb_page_compressed1 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed2 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed3 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed4 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed5 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed6 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed7 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed8 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed9 where c1 < 500000; -count(*) -5000 -alter table innodb_normal page_compressed=1 page_compression_level=8; -show warnings; -Level Code Message -show create table innodb_normal; -Table Create Table -innodb_normal CREATE TABLE `innodb_normal` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=8 -alter table innodb_compressed row_format=default page_compressed=1 page_compression_level=8 key_block_size=0; -show warnings; -Level Code Message -show create table innodb_compressed; -Table Create Table -innodb_compressed CREATE TABLE `innodb_compressed` ( - `c1` int(11) DEFAULT NULL, - `b` char(20) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=8 -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -select count(*) from innodb_compressed; -count(*) -5000 -select count(*) from innodb_page_compressed1; -count(*) -5000 -select count(*) from innodb_page_compressed1 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed2 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed3 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed4 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed5 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed6 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed7 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed8 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed9 where c1 < 500000; -count(*) -5000 -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -select count(*) from innodb_compressed; -count(*) -5000 -select count(*) from innodb_page_compressed1; -count(*) -5000 -select count(*) from innodb_page_compressed1 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed2 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed3 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed4 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed5 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed6 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed7 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed8 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed9 where c1 < 500000; -count(*) -5000 -set global innodb_compression_algorithm = 0; -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -commit; -select count(*) from innodb_compressed; -count(*) -5000 -select count(*) from innodb_page_compressed1; -count(*) -5000 -select count(*) from innodb_page_compressed1 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed2 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed3 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed4 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed5 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed6 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed7 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed8 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed9 where c1 < 500000; -count(*) -5000 -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -select count(*) from innodb_compressed; -count(*) -5000 -select count(*) from innodb_page_compressed1; -count(*) -5000 -select count(*) from innodb_page_compressed1 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed2 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed3 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed4 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed5 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed6 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed7 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed8 where c1 < 500000; -count(*) -5000 -select count(*) from innodb_page_compressed9 where c1 < 500000; -count(*) -5000 -drop procedure innodb_insert_proc; -drop table innodb_normal; -drop table innodb_compressed; -drop table innodb_page_compressed1; -drop table innodb_page_compressed2; -drop table innodb_page_compressed3; -drop table innodb_page_compressed4; -drop table innodb_page_compressed5; -drop table innodb_page_compressed6; -drop table innodb_page_compressed7; -drop table innodb_page_compressed8; -drop table innodb_page_compressed9; +set global innodb_compression_algorithm = zlib; +select @@innodb_compression_algorithm; +@@innodb_compression_algorithm +zlib +set global innodb_file_format = `Barracuda`; +set global innodb_file_per_table = on; +call mtr.add_suppression("InnoDB: Database page corruption on disk or a failed file read of tablespace test/t[0-9]+ page \\[page id: space=[0-9]+, page number=[0-9]+\\]. You may have to recover from a backup."); +call mtr.add_suppression("InnoDB: Page \\[page id: space=[0-9]+, page number= [0-9]+\\] in file ./test/t[0-9]+.ibd may be corrupted. Post compression checksum [0-9]+ stored [0-9]+ compression_method [ZLIB|SNAPPY|LZ4|LZO|LZMA|BZIP2]"); +call mtr.add_suppression("InnoDB: Background Page read failed to read or decrypt \\[page id: space=[0-9]+, page number=[0-9]+\\]"); +call mtr.add_suppression("mysqld: Index for table 't[0-9]+' is corrupt; try to repair it"); +create table t0 (c1 int not null auto_increment primary key, b char(200)) engine=innodb; +create table t1 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=1; +create table t2 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=2; +create table t3 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=3; +create table t4 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=4; +create table t5 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=5; +create table t6 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=6; +create table t7 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=7; +create table t8 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=8; +create table t9 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=9; +select count(*) from t1; +count(*) +500 +select count(*) from t3; +count(*) +500 +select count(*) from t4; +count(*) +500 +select count(*) from t5; +count(*) +500 +select count(*) from t6; +count(*) +500 +select count(*) from t6; +count(*) +500 +select count(*) from t7; +count(*) +500 +select count(*) from t8; +count(*) +500 +select count(*) from t9; +count(*) +500 +# t0 expected FOUND +FOUND 1284 /AaAaAaAa/ in t0.ibd +# t1 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t1.ibd +# t2 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t2.ibd +# t3 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t3.ibd +# t4 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t4.ibd +# t5 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t5.ibd +# t6 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t6.ibd +# t7 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t7.ibd +# t8 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t8.ibd +# t9 page compressed expected NOT FOUND +NOT FOUND /AaAaAaAa/ in t9.ibd +# Run innochecksum on t9 +# Run innochecksum on t8 +# Run innochecksum on t7 +# Run innochecksum on t6 +# Run innochecksum on t5 +# Run innochecksum on t4 +# Run innochecksum on t3 +# Run innochecksum on t2 +# Run innochecksum on t1 +select count(*) from t0; +count(*) +500 +select count(*) from t1; +count(*) +500 +select count(*) from t3; +count(*) +500 +select count(*) from t4; +count(*) +500 +select count(*) from t5; +count(*) +500 +select count(*) from t6; +count(*) +500 +select count(*) from t7; +count(*) +500 +select count(*) from t8; +count(*) +500 +select count(*) from t9; +count(*) +500 +# Restart server +# Corrupting tablespaces... +# Corruption done +# Run innochecksum on t4 +# Run innochecksum on t3 +# Run innochecksum on t2 +# Run innochecksum on t1 +# Start server again +select * from t1; +ERROR HY000: Index for table 't1' is corrupt; try to repair it +select * from t2; +ERROR HY000: Index for table 't2' is corrupt; try to repair it +select * from t3; +ERROR HY000: Index for table 't3' is corrupt; try to repair it +select * from t4; +ERROR HY000: Index for table 't4' is corrupt; try to repair it +select count(*) from t5; +count(*) +500 +select count(*) from t6; +count(*) +500 +select count(*) from t7; +count(*) +500 +select count(*) from t8; +count(*) +500 +select count(*) from t9; +count(*) +500 +drop table t0, t1, t2, t3, t4, t5, t6, t7, t8, t9; +#done diff --git a/mysql-test/suite/innodb/t/doublewrite-compressed.test b/mysql-test/suite/innodb/t/doublewrite-compressed.test new file mode 100644 index 00000000000..f3aa5171f18 --- /dev/null +++ b/mysql-test/suite/innodb/t/doublewrite-compressed.test @@ -0,0 +1,439 @@ +--echo # +--echo # Bug #17335427 INNODB CAN NOT USE THE DOUBLEWRITE BUFFER PROPERLY +--echo # Bug #18144349 INNODB CANNOT USE THE DOUBLEWRITE BUFFER FOR THE FIRST +--echo # PAGE OF SYSTEM TABLESPACE +--echo # + +--source include/innodb_page_size.inc +--source include/have_debug.inc +--source include/not_embedded.inc + +# Slow shutdown and restart to make sure ibuf merge is finished +SET GLOBAL innodb_fast_shutdown = 0; +--disable_query_log +call mtr.add_suppression("InnoDB: Header page consists of zero bytes"); +call mtr.add_suppression("InnoDB: Checksum mismatch in datafile: .*, Space ID:0, Flags: 0"); +call mtr.add_suppression("InnoDB: Data file .* uses page size .* but the innodb_page_size start-up parameter is"); +call mtr.add_suppression("InnoDB: adjusting FSP_SPACE_FLAGS"); +call mtr.add_suppression("InnoDB: New log files created"); +call mtr.add_suppression("InnoDB: Cannot create doublewrite buffer: the first file in innodb_data_file_path must be at least (3|6|12)M\\."); +call mtr.add_suppression("InnoDB: Database creation was aborted"); +call mtr.add_suppression("Plugin 'InnoDB' (init function returned error|registration as a STORAGE ENGINE failed)"); +--enable_query_log +--source include/restart_mysqld.inc + +let INNODB_PAGE_SIZE=`select @@innodb_page_size`; +let MYSQLD_DATADIR=`select @@datadir`; +let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err; + +show variables like 'innodb_doublewrite'; +show variables like 'innodb_fil_make_page_dirty_debug'; +show variables like 'innodb_saved_page_number_debug'; + +--disable_warnings +SET GLOBAL innodb_file_format = `Barracuda`; +SET GLOBAL innodb_file_per_table = ON; +SET GLOBAL innodb_compression_algorithm = 1; +--enable_warnings +create table t1 (f1 int primary key, f2 blob) engine=innodb page_compressed=yes; + +start transaction; +insert into t1 values(1, repeat('#',12)); +insert into t1 values(2, repeat('+',12)); +insert into t1 values(3, repeat('/',12)); +insert into t1 values(4, repeat('-',12)); +insert into t1 values(5, repeat('.',12)); +commit work; + +--echo # --------------------------------------------------------------- +--echo # Test Begin: Test if recovery works if first page of user +--echo # tablespace is full of zeroes. + +select space from information_schema.innodb_sys_tables +where name = 'test/t1' into @space_id; + +--echo # Ensure that dirty pages of table t1 is flushed. +flush tables t1 for export; +unlock tables; + +begin; +insert into t1 values (6, repeat('%', 12)); + +--source ../include/no_checkpoint_start.inc + +--echo # Make the first page dirty for table t1 +set global innodb_saved_page_number_debug = 0; +set global innodb_fil_make_page_dirty_debug = @space_id; + +--echo # Ensure that dirty pages of table t1 are flushed. +set global innodb_buf_flush_list_now = 1; + +--let CLEANUP_IF_CHECKPOINT=drop table t1; +--source ../include/no_checkpoint_end.inc + +--echo # Make the first page (page_no=0) of the user tablespace +--echo # full of zeroes. +--echo # +--echo # MDEV-11623: Use old FSP_SPACE_FLAGS in the doublewrite buffer. + +perl; +use IO::Handle; +my $fname= "$ENV{'MYSQLD_DATADIR'}test/t1.ibd"; +my $page_size = $ENV{INNODB_PAGE_SIZE}; +my $page; +open(FILE, "+<", $fname) or die; +sysread(FILE, $page, $page_size)==$page_size||die "Unable to read $name\n"; +sysseek(FILE, 0, 0)||die "Unable to seek $fname\n"; +die unless syswrite(FILE, chr(0) x $page_size, $page_size) == $page_size; +close FILE; + +open(FILE, "+<", "$ENV{MYSQLD_DATADIR}ibdata1")||die "cannot open ibdata1\n"; +sysseek(FILE, 6 * $page_size - 190, 0)||die "Unable to seek ibdata1\n"; +sysread(FILE, $_, 12) == 12||die "Unable to read TRX_SYS\n"; +my($magic,$d1,$d2)=unpack "NNN", $_; +die "magic=$magic, $d1, $d2\n" unless $magic == 536853855 && $d2 >= $d1 + 64; +sysseek(FILE, $d1 * $page_size, 0)||die "Unable to seek ibdata1\n"; +# Find the page in the doublewrite buffer +for (my $d = $d1; $d < $d2 + 64; $d++) +{ + sysread(FILE, $_, $page_size)==$page_size||die "Cannot read doublewrite\n"; + next unless $_ eq $page; + sysseek(FILE, $d * $page_size, 0)||die "Unable to seek ibdata1\n"; + # Write buggy MariaDB 10.1.x FSP_SPACE_FLAGS to the doublewrite buffer + my($flags) = unpack "x[54]N", $_; + my $badflags = ($flags & 0x3f); + my $compression_level=6; + $badflags |= 1<<6|$compression_level<<7 if ($flags & 1 << 16); + $badflags |= ($flags & 15 << 6) << 7; # PAGE_SSIZE + + substr ($_, 54, 4) = pack("N", $badflags); + # Replace the innodb_checksum_algorithm=none checksum + substr ($_, 0, 4) = pack("N", 0xdeadbeef); + substr ($_, $page_size - 8, 4) = pack("N", 0xdeadbeef); + syswrite(FILE, $_, $page_size)==$page_size||die; + close(FILE); + exit 0; +} +die "Did not find the page in the doublewrite buffer ($d1,$d2)\n"; +EOF + +--source include/start_mysqld.inc + +check table t1; +select f1, f2 from t1; + +--echo # Test End +--echo # --------------------------------------------------------------- +--echo # Test Begin: Test if recovery works if first page of user +--echo # tablespace is corrupted. + +select space from information_schema.innodb_sys_tables +where name = 'test/t1' into @space_id; + +--echo # Ensure that dirty pages of table t1 is flushed. +flush tables t1 for export; +unlock tables; + +begin; +insert into t1 values (6, repeat('%', 12)); + +--source ../include/no_checkpoint_start.inc + +--echo # Make the first page dirty for table t1 +set global innodb_saved_page_number_debug = 0; +set global innodb_fil_make_page_dirty_debug = @space_id; + +--echo # Ensure that dirty pages of table t1 are flushed. +set global innodb_buf_flush_list_now = 1; + +--source include/no_checkpoint_end.inc + +--echo # Corrupt the first page (page_no=0) of the user tablespace. +perl; +use IO::Handle; +my $fname= "$ENV{'MYSQLD_DATADIR'}test/t1.ibd"; +open(FILE, "+<", $fname) or die; +FILE->autoflush(1); +binmode FILE; +print FILE chr(0) x ($ENV{'INNODB_PAGE_SIZE'}/2); +close FILE; +EOF + +--source include/start_mysqld.inc + +check table t1; +select f1, f2 from t1; + +--echo # Test End +--echo # --------------------------------------------------------------- +--echo # Test Begin: Test if recovery works if 2nd page of user +--echo # tablespace is full of zeroes. + +select space from information_schema.innodb_sys_tables +where name = 'test/t1' into @space_id; + +--echo # Ensure that dirty pages of table t1 is flushed. +flush tables t1 for export; +unlock tables; + +begin; +insert into t1 values (6, repeat('%', 400)); + +--source ../include/no_checkpoint_start.inc + +--echo # Make the 2nd page dirty for table t1 +set global innodb_saved_page_number_debug = 1; +set global innodb_fil_make_page_dirty_debug = @space_id; + +--echo # Ensure that dirty pages of table t1 are flushed. +set global innodb_buf_flush_list_now = 1; + +--source include/no_checkpoint_end.inc + +--echo # Make the 2nd page (page_no=1) of the tablespace all zeroes. +perl; +use IO::Handle; +my $fname= "$ENV{'MYSQLD_DATADIR'}test/t1.ibd"; +open(FILE, "+<", $fname) or die; +FILE->autoflush(1); +binmode FILE; +seek(FILE, $ENV{'INNODB_PAGE_SIZE'}, SEEK_SET); +print FILE chr(0) x ($ENV{'INNODB_PAGE_SIZE'}); +close FILE; +EOF + +--source include/start_mysqld.inc + +check table t1; +select f1, f2 from t1; + +--echo # Test End +--echo # --------------------------------------------------------------- +--echo # Test Begin: Test if recovery works if 2nd page of user +--echo # tablespace is corrupted. + +select space from information_schema.innodb_sys_tables +where name = 'test/t1' into @space_id; + +--echo # Ensure that dirty pages of table t1 is flushed. +flush tables t1 for export; +unlock tables; + +begin; +insert into t1 values (6, repeat('%', 400)); + +--source ../include/no_checkpoint_start.inc + +--echo # Make the 2nd page dirty for table t1 +set global innodb_saved_page_number_debug = 1; +set global innodb_fil_make_page_dirty_debug = @space_id; + +--echo # Ensure that the dirty pages of table t1 are flushed. +set global innodb_buf_flush_list_now = 1; + +--source include/no_checkpoint_end.inc + +--echo # Corrupt the 2nd page (page_no=1) of the user tablespace. +perl; +use IO::Handle; +my $fname= "$ENV{'MYSQLD_DATADIR'}test/t1.ibd"; +open(FILE, "+<", $fname) or die; +FILE->autoflush(1); +binmode FILE; +seek(FILE, $ENV{'INNODB_PAGE_SIZE'}, SEEK_SET); +print FILE chr(0) x ($ENV{'INNODB_PAGE_SIZE'}/2); +close FILE; +EOF + +--source include/start_mysqld.inc + +check table t1; +select f1, f2 from t1; + +--echo # Test End +--echo # --------------------------------------------------------------- +--echo # Test Begin: Test if recovery works if first page of +--echo # system tablespace is full of zeroes. + +begin; +insert into t1 values (6, repeat('%', 400)); + +--echo # Ensure that all dirty pages in the system are flushed. +set global innodb_buf_flush_list_now = 1; + +--echo # Make the first page dirty for system tablespace +set global innodb_saved_page_number_debug = 0; +set global innodb_fil_make_page_dirty_debug = 0; + +--echo # Ensure that the dirty page of system tablespace is also flushed. +# We do this after the transaction starts and all dirty pages have been flushed +# already. So flushing of this specified dirty page will surely keep the +# copy in doublewrite buffer, and no more writes to doublewrite buffer would +# overwrite the copy. Thus, we can safely modify the original page when server +# is down. So do the following testings. +set global innodb_buf_flush_list_now = 1; + +--source include/kill_mysqld.inc + +--echo # Make the first page (page_no=0) of the system tablespace +--echo # all zeroes. +perl; +use IO::Handle; +my $fname= "$ENV{'MYSQLD_DATADIR'}ibdata1"; +open(FILE, "+<", $fname) or die; +FILE->autoflush(1); +binmode FILE; +print FILE chr(0) x ($ENV{'INNODB_PAGE_SIZE'}); +close FILE; +EOF + +--source include/start_mysqld.inc + +check table t1; +select f1, f2 from t1; + +--echo # Test End +--echo # --------------------------------------------------------------- +--echo # Test Begin: Test if recovery works if first page of +--echo # system tablespace is corrupted. + +begin; +insert into t1 values (6, repeat('%', 400)); + +--echo # Ensure that all dirty pages in the system are flushed. +set global innodb_buf_flush_list_now = 1; + +--echo # Make the first page dirty for system tablespace +set global innodb_saved_page_number_debug = 0; +set global innodb_fil_make_page_dirty_debug = 0; + +--echo # Ensure that the dirty page of system tablespace is also flushed. +set global innodb_buf_flush_list_now = 1; + +--source include/kill_mysqld.inc + +--echo # Corrupt the first page (page_no=0) of the system tablespace. +perl; +use IO::Handle; +my $fname= "$ENV{'MYSQLD_DATADIR'}ibdata1"; +open(FILE, "+<", $fname) or die; +FILE->autoflush(1); +binmode FILE; +print FILE chr(0) x ($ENV{'INNODB_PAGE_SIZE'}/2); +close FILE; +EOF + +--source include/start_mysqld.inc + +check table t1; +select f1, f2 from t1; + +--echo # Test End +--echo # --------------------------------------------------------------- +--echo # Test Begin: Test if recovery works if 2nd page of +--echo # system tablespace is full of zeroes. + +begin; +insert into t1 values (6, repeat('%', 400)); + +--echo # Ensure that all dirty pages in the system are flushed. +set global innodb_buf_flush_list_now = 1; + +--echo # Make the second page dirty for system tablespace +set global innodb_saved_page_number_debug = 1; +set global innodb_fil_make_page_dirty_debug = 0; + +--echo # Ensure that the dirty page of system tablespace is also flushed. +set global innodb_buf_flush_list_now = 1; + +--source include/kill_mysqld.inc + +--echo # Make the 2nd page (page_no=1) of the system tablespace +--echo # all zeroes. +perl; +use IO::Handle; +my $fname= "$ENV{'MYSQLD_DATADIR'}ibdata1"; +open(FILE, "+<", $fname) or die; +FILE->autoflush(1); +binmode FILE; +seek(FILE, $ENV{'INNODB_PAGE_SIZE'}, SEEK_SET); +print FILE chr(0) x ($ENV{'INNODB_PAGE_SIZE'}); +close FILE; +EOF + +--source include/start_mysqld.inc + +check table t1; +select f1, f2 from t1; + +--echo # Test End +--echo # --------------------------------------------------------------- +--echo # Test Begin: Test if recovery works if 2nd page of +--echo # system tablespace is corrupted. + +begin; +insert into t1 values (6, repeat('%', 400)); + +--echo # Ensure that all dirty pages in the system are flushed. +set global innodb_buf_flush_list_now = 1; + +--echo # Make the second page dirty for system tablespace +set global innodb_saved_page_number_debug = 1; +set global innodb_fil_make_page_dirty_debug = 0; + +--echo # Ensure that the dirty page of system tablespace is also flushed. +set global innodb_buf_flush_list_now = 1; + +--source include/kill_mysqld.inc + +--echo # Make the 2nd page (page_no=1) of the system tablespace +--echo # all zeroes. +perl; +use IO::Handle; +my $fname= "$ENV{'MYSQLD_DATADIR'}ibdata1"; +open(FILE, "+<", $fname) or die; +FILE->autoflush(1); +binmode FILE; +seek(FILE, $ENV{'INNODB_PAGE_SIZE'}, SEEK_SET); +print FILE chr(0) x ($ENV{'INNODB_PAGE_SIZE'}/2); +close FILE; +EOF + +--source include/start_mysqld.inc + +check table t1; +--let SEARCH_PATTERN= \[ERROR\] InnoDB: .*test.t1\\.ibd.* +--source include/search_pattern_in_file.inc + +select f1, f2 from t1; + +drop table t1; + +--echo # +--echo # MDEV-12600 crash during install_db with innodb_page_size=32K +--echo # and ibdata1=3M +--echo # +let bugdir= $MYSQLTEST_VARDIR/tmp/doublewrite; +--mkdir $bugdir + +let $check_no_innodb=SELECT * FROM INFORMATION_SCHEMA.ENGINES +WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); + +--let $ibp=--innodb-log-group-home-dir=$bugdir --innodb-data-home-dir=$bugdir +--let $ibd=$ibp --innodb-undo-tablespaces=0 --innodb-log-files-in-group=2 +--let $ibp=$ibp --innodb-data-file-path=ibdata1:1M;ibdata2:1M:autoextend + +--let $restart_parameters= $ibp +--source include/restart_mysqld.inc +eval $check_no_innodb; +--let SEARCH_PATTERN= \[ERROR\] InnoDB: Cannot create doublewrite buffer +--source include/search_pattern_in_file.inc +--let $restart_parameters= +--source include/restart_mysqld.inc + +--remove_file $bugdir/ibdata1 +--remove_file $bugdir/ibdata2 +--remove_file $bugdir/ib_logfile0 +--remove_file $bugdir/ib_logfile1 +--rmdir $bugdir diff --git a/mysql-test/suite/innodb/t/innodb-page_compression_bzip2.test b/mysql-test/suite/innodb/t/innodb-page_compression_bzip2.test index 69a632d6010..866c44fac41 100644 --- a/mysql-test/suite/innodb/t/innodb-page_compression_bzip2.test +++ b/mysql-test/suite/innodb/t/innodb-page_compression_bzip2.test @@ -5,237 +5,13 @@ let $innodb_compression_algorithm_orig=`select @@innodb_compression_algorithm`; # bzip2 -set global innodb_compression_algorithm = 5; +set global innodb_compression_algorithm = bzip2; +select @@innodb_compression_algorithm; -create table innodb_compressed(c1 int, b char(20)) engine=innodb row_format=compressed key_block_size=8; -show warnings; -create table innodb_normal (c1 int, b char(20)) engine=innodb; -show warnings; -create table innodb_page_compressed1 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=1; -show warnings; -show create table innodb_page_compressed1; -create table innodb_page_compressed2 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=2; -show warnings; -show create table innodb_page_compressed2; -create table innodb_page_compressed3 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=3; -show warnings; -show create table innodb_page_compressed3; -create table innodb_page_compressed4 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=4; -show warnings; -show create table innodb_page_compressed4; -create table innodb_page_compressed5 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=5; -show warnings; -show create table innodb_page_compressed5; -create table innodb_page_compressed6 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=6; -show warnings; -show create table innodb_page_compressed6; -create table innodb_page_compressed7 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=7; -show warnings; -show create table innodb_page_compressed7; -create table innodb_page_compressed8 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=8; -show warnings; -show create table innodb_page_compressed8; -create table innodb_page_compressed9 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=9; -show warnings; -show create table innodb_page_compressed9; -delimiter //; -create procedure innodb_insert_proc (repeat_count int) -begin - declare current_num int; - set current_num = 0; - while current_num < repeat_count do - insert into innodb_normal values(current_num,'testing..'); - set current_num = current_num + 1; - end while; -end// -delimiter ;// -commit; +# All page compression tests use the same +--source include/innodb-page-compression.inc -set autocommit=0; -call innodb_insert_proc(5000); -commit; -set autocommit=1; -select count(*) from innodb_normal; -insert into innodb_compressed select * from innodb_normal; -insert into innodb_page_compressed1 select * from innodb_normal; -insert into innodb_page_compressed2 select * from innodb_normal; -insert into innodb_page_compressed3 select * from innodb_normal; -insert into innodb_page_compressed4 select * from innodb_normal; -insert into innodb_page_compressed5 select * from innodb_normal; -insert into innodb_page_compressed6 select * from innodb_normal; -insert into innodb_page_compressed7 select * from innodb_normal; -insert into innodb_page_compressed8 select * from innodb_normal; -insert into innodb_page_compressed9 select * from innodb_normal; -commit; -select count(*) from innodb_compressed; -select count(*) from innodb_page_compressed1; -select count(*) from innodb_page_compressed1 where c1 < 500000; -select count(*) from innodb_page_compressed2 where c1 < 500000; -select count(*) from innodb_page_compressed3 where c1 < 500000; -select count(*) from innodb_page_compressed4 where c1 < 500000; -select count(*) from innodb_page_compressed5 where c1 < 500000; -select count(*) from innodb_page_compressed6 where c1 < 500000; -select count(*) from innodb_page_compressed7 where c1 < 500000; -select count(*) from innodb_page_compressed8 where c1 < 500000; -select count(*) from innodb_page_compressed9 where c1 < 500000; - -alter table innodb_normal page_compressed=1 page_compression_level=8; -show warnings; -show create table innodb_normal; -alter table innodb_compressed row_format=default page_compressed=1 page_compression_level=8 key_block_size=0; -show warnings; -show create table innodb_compressed; - -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -select count(*) from innodb_compressed; -select count(*) from innodb_page_compressed1; -select count(*) from innodb_page_compressed1 where c1 < 500000; -select count(*) from innodb_page_compressed2 where c1 < 500000; -select count(*) from innodb_page_compressed3 where c1 < 500000; -select count(*) from innodb_page_compressed4 where c1 < 500000; -select count(*) from innodb_page_compressed5 where c1 < 500000; -select count(*) from innodb_page_compressed6 where c1 < 500000; -select count(*) from innodb_page_compressed7 where c1 < 500000; -select count(*) from innodb_page_compressed8 where c1 < 500000; -select count(*) from innodb_page_compressed9 where c1 < 500000; - ---source include/restart_mysqld.inc - -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -select count(*) from innodb_compressed; -select count(*) from innodb_page_compressed1; -select count(*) from innodb_page_compressed1 where c1 < 500000; -select count(*) from innodb_page_compressed2 where c1 < 500000; -select count(*) from innodb_page_compressed3 where c1 < 500000; -select count(*) from innodb_page_compressed4 where c1 < 500000; -select count(*) from innodb_page_compressed5 where c1 < 500000; -select count(*) from innodb_page_compressed6 where c1 < 500000; -select count(*) from innodb_page_compressed7 where c1 < 500000; -select count(*) from innodb_page_compressed8 where c1 < 500000; -select count(*) from innodb_page_compressed9 where c1 < 500000; - -# zlib -set global innodb_compression_algorithm = 1; -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -commit; -select count(*) from innodb_compressed; -select count(*) from innodb_page_compressed1; -select count(*) from innodb_page_compressed1 where c1 < 500000; -select count(*) from innodb_page_compressed2 where c1 < 500000; -select count(*) from innodb_page_compressed3 where c1 < 500000; -select count(*) from innodb_page_compressed4 where c1 < 500000; -select count(*) from innodb_page_compressed5 where c1 < 500000; -select count(*) from innodb_page_compressed6 where c1 < 500000; -select count(*) from innodb_page_compressed7 where c1 < 500000; -select count(*) from innodb_page_compressed8 where c1 < 500000; -select count(*) from innodb_page_compressed9 where c1 < 500000; - ---source include/restart_mysqld.inc - -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -select count(*) from innodb_compressed; -select count(*) from innodb_page_compressed1; -select count(*) from innodb_page_compressed1 where c1 < 500000; -select count(*) from innodb_page_compressed2 where c1 < 500000; -select count(*) from innodb_page_compressed3 where c1 < 500000; -select count(*) from innodb_page_compressed4 where c1 < 500000; -select count(*) from innodb_page_compressed5 where c1 < 500000; -select count(*) from innodb_page_compressed6 where c1 < 500000; -select count(*) from innodb_page_compressed7 where c1 < 500000; -select count(*) from innodb_page_compressed8 where c1 < 500000; -select count(*) from innodb_page_compressed9 where c1 < 500000; - -# none -set global innodb_compression_algorithm = 0; -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -commit; -select count(*) from innodb_compressed; -select count(*) from innodb_page_compressed1; -select count(*) from innodb_page_compressed1 where c1 < 500000; -select count(*) from innodb_page_compressed2 where c1 < 500000; -select count(*) from innodb_page_compressed3 where c1 < 500000; -select count(*) from innodb_page_compressed4 where c1 < 500000; -select count(*) from innodb_page_compressed5 where c1 < 500000; -select count(*) from innodb_page_compressed6 where c1 < 500000; -select count(*) from innodb_page_compressed7 where c1 < 500000; -select count(*) from innodb_page_compressed8 where c1 < 500000; -select count(*) from innodb_page_compressed9 where c1 < 500000; - ---source include/restart_mysqld.inc - -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -select count(*) from innodb_compressed; -select count(*) from innodb_page_compressed1; -select count(*) from innodb_page_compressed1 where c1 < 500000; -select count(*) from innodb_page_compressed2 where c1 < 500000; -select count(*) from innodb_page_compressed3 where c1 < 500000; -select count(*) from innodb_page_compressed4 where c1 < 500000; -select count(*) from innodb_page_compressed5 where c1 < 500000; -select count(*) from innodb_page_compressed6 where c1 < 500000; -select count(*) from innodb_page_compressed7 where c1 < 500000; -select count(*) from innodb_page_compressed8 where c1 < 500000; -select count(*) from innodb_page_compressed9 where c1 < 500000; - -drop procedure innodb_insert_proc; -drop table innodb_normal; -drop table innodb_compressed; -drop table innodb_page_compressed1; -drop table innodb_page_compressed2; -drop table innodb_page_compressed3; -drop table innodb_page_compressed4; -drop table innodb_page_compressed5; -drop table innodb_page_compressed6; -drop table innodb_page_compressed7; -drop table innodb_page_compressed8; -drop table innodb_page_compressed9; +-- echo #done # reset system --disable_query_log diff --git a/mysql-test/suite/innodb/t/innodb-page_compression_lz4.test b/mysql-test/suite/innodb/t/innodb-page_compression_lz4.test index 1b1df674e3c..8ebc66b0183 100644 --- a/mysql-test/suite/innodb/t/innodb-page_compression_lz4.test +++ b/mysql-test/suite/innodb/t/innodb-page_compression_lz4.test @@ -5,238 +5,13 @@ let $innodb_compression_algorithm_orig=`SELECT @@innodb_compression_algorithm`; # lz4 -set global innodb_compression_algorithm = 2; +set global innodb_compression_algorithm = lz4; +select @@innodb_compression_algorithm; -create table innodb_compressed(c1 int, b char(20)) engine=innodb row_format=compressed key_block_size=8; -show warnings; -create table innodb_normal (c1 int, b char(20)) engine=innodb; -show warnings; -create table innodb_page_compressed1 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=1; -show warnings; -show create table innodb_page_compressed1; -create table innodb_page_compressed2 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=2; -show warnings; -show create table innodb_page_compressed2; -create table innodb_page_compressed3 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=3; -show warnings; -show create table innodb_page_compressed3; -create table innodb_page_compressed4 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=4; -show warnings; -show create table innodb_page_compressed4; -create table innodb_page_compressed5 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=5; -show warnings; -show create table innodb_page_compressed5; -create table innodb_page_compressed6 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=6; -show warnings; -show create table innodb_page_compressed6; -create table innodb_page_compressed7 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=7; -show warnings; -show create table innodb_page_compressed7; -create table innodb_page_compressed8 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=8; -show warnings; -show create table innodb_page_compressed8; -create table innodb_page_compressed9 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=9; -show warnings; -show create table innodb_page_compressed9; -delimiter //; -create procedure innodb_insert_proc (repeat_count int) -begin - declare current_num int; - set current_num = 0; - while current_num < repeat_count do - insert into innodb_normal values(current_num,'testing..'); - set current_num = current_num + 1; - end while; -end// -delimiter ;// -commit; +# All page compression tests use the same +--source include/innodb-page-compression.inc -set autocommit=0; -call innodb_insert_proc(5000); -commit; -set autocommit=1; -select count(*) from innodb_normal; -insert into innodb_compressed select * from innodb_normal; -insert into innodb_page_compressed1 select * from innodb_normal; -insert into innodb_page_compressed2 select * from innodb_normal; -insert into innodb_page_compressed3 select * from innodb_normal; -insert into innodb_page_compressed4 select * from innodb_normal; -insert into innodb_page_compressed5 select * from innodb_normal; -insert into innodb_page_compressed6 select * from innodb_normal; -insert into innodb_page_compressed7 select * from innodb_normal; -insert into innodb_page_compressed8 select * from innodb_normal; -insert into innodb_page_compressed9 select * from innodb_normal; -commit; -select count(*) from innodb_compressed; -select count(*) from innodb_page_compressed1; -select count(*) from innodb_page_compressed1 where c1 < 500000; -select count(*) from innodb_page_compressed2 where c1 < 500000; -select count(*) from innodb_page_compressed3 where c1 < 500000; -select count(*) from innodb_page_compressed4 where c1 < 500000; -select count(*) from innodb_page_compressed5 where c1 < 500000; -select count(*) from innodb_page_compressed6 where c1 < 500000; -select count(*) from innodb_page_compressed7 where c1 < 500000; -select count(*) from innodb_page_compressed8 where c1 < 500000; -select count(*) from innodb_page_compressed9 where c1 < 500000; - -alter table innodb_normal page_compressed=1 page_compression_level=8; -show warnings; -show create table innodb_normal; -alter table innodb_compressed row_format=default page_compressed=1 page_compression_level=8 key_block_size=0; -show warnings; -show create table innodb_compressed; - -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -commit; -select count(*) from innodb_compressed; -select count(*) from innodb_page_compressed1; -select count(*) from innodb_page_compressed1 where c1 < 500000; -select count(*) from innodb_page_compressed2 where c1 < 500000; -select count(*) from innodb_page_compressed3 where c1 < 500000; -select count(*) from innodb_page_compressed4 where c1 < 500000; -select count(*) from innodb_page_compressed5 where c1 < 500000; -select count(*) from innodb_page_compressed6 where c1 < 500000; -select count(*) from innodb_page_compressed7 where c1 < 500000; -select count(*) from innodb_page_compressed8 where c1 < 500000; -select count(*) from innodb_page_compressed9 where c1 < 500000; - ---source include/restart_mysqld.inc - -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -select count(*) from innodb_compressed; -select count(*) from innodb_page_compressed1; -select count(*) from innodb_page_compressed1 where c1 < 500000; -select count(*) from innodb_page_compressed2 where c1 < 500000; -select count(*) from innodb_page_compressed3 where c1 < 500000; -select count(*) from innodb_page_compressed4 where c1 < 500000; -select count(*) from innodb_page_compressed5 where c1 < 500000; -select count(*) from innodb_page_compressed6 where c1 < 500000; -select count(*) from innodb_page_compressed7 where c1 < 500000; -select count(*) from innodb_page_compressed8 where c1 < 500000; -select count(*) from innodb_page_compressed9 where c1 < 500000; - -# zlib -set global innodb_compression_algorithm = 1; -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -commit; -select count(*) from innodb_compressed; -select count(*) from innodb_page_compressed1; -select count(*) from innodb_page_compressed1 where c1 < 500000; -select count(*) from innodb_page_compressed2 where c1 < 500000; -select count(*) from innodb_page_compressed3 where c1 < 500000; -select count(*) from innodb_page_compressed4 where c1 < 500000; -select count(*) from innodb_page_compressed5 where c1 < 500000; -select count(*) from innodb_page_compressed6 where c1 < 500000; -select count(*) from innodb_page_compressed7 where c1 < 500000; -select count(*) from innodb_page_compressed8 where c1 < 500000; -select count(*) from innodb_page_compressed9 where c1 < 500000; - ---source include/restart_mysqld.inc - -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -select count(*) from innodb_compressed; -select count(*) from innodb_page_compressed1; -select count(*) from innodb_page_compressed1 where c1 < 500000; -select count(*) from innodb_page_compressed2 where c1 < 500000; -select count(*) from innodb_page_compressed3 where c1 < 500000; -select count(*) from innodb_page_compressed4 where c1 < 500000; -select count(*) from innodb_page_compressed5 where c1 < 500000; -select count(*) from innodb_page_compressed6 where c1 < 500000; -select count(*) from innodb_page_compressed7 where c1 < 500000; -select count(*) from innodb_page_compressed8 where c1 < 500000; -select count(*) from innodb_page_compressed9 where c1 < 500000; - -# none -set global innodb_compression_algorithm = 0; -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -commit; -select count(*) from innodb_compressed; -select count(*) from innodb_page_compressed1; -select count(*) from innodb_page_compressed1 where c1 < 500000; -select count(*) from innodb_page_compressed2 where c1 < 500000; -select count(*) from innodb_page_compressed3 where c1 < 500000; -select count(*) from innodb_page_compressed4 where c1 < 500000; -select count(*) from innodb_page_compressed5 where c1 < 500000; -select count(*) from innodb_page_compressed6 where c1 < 500000; -select count(*) from innodb_page_compressed7 where c1 < 500000; -select count(*) from innodb_page_compressed8 where c1 < 500000; -select count(*) from innodb_page_compressed9 where c1 < 500000; - ---source include/restart_mysqld.inc - -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -select count(*) from innodb_compressed; -select count(*) from innodb_page_compressed1; -select count(*) from innodb_page_compressed1 where c1 < 500000; -select count(*) from innodb_page_compressed2 where c1 < 500000; -select count(*) from innodb_page_compressed3 where c1 < 500000; -select count(*) from innodb_page_compressed4 where c1 < 500000; -select count(*) from innodb_page_compressed5 where c1 < 500000; -select count(*) from innodb_page_compressed6 where c1 < 500000; -select count(*) from innodb_page_compressed7 where c1 < 500000; -select count(*) from innodb_page_compressed8 where c1 < 500000; -select count(*) from innodb_page_compressed9 where c1 < 500000; - -drop procedure innodb_insert_proc; -drop table innodb_normal; -drop table innodb_compressed; -drop table innodb_page_compressed1; -drop table innodb_page_compressed2; -drop table innodb_page_compressed3; -drop table innodb_page_compressed4; -drop table innodb_page_compressed5; -drop table innodb_page_compressed6; -drop table innodb_page_compressed7; -drop table innodb_page_compressed8; -drop table innodb_page_compressed9; +-- echo #done # reset system --disable_query_log diff --git a/mysql-test/suite/innodb/t/innodb-page_compression_lzma.test b/mysql-test/suite/innodb/t/innodb-page_compression_lzma.test index 9cec3e7a947..d9c08b1a328 100644 --- a/mysql-test/suite/innodb/t/innodb-page_compression_lzma.test +++ b/mysql-test/suite/innodb/t/innodb-page_compression_lzma.test @@ -5,237 +5,12 @@ let $innodb_compression_algorithm_orig=`SELECT @@innodb_compression_algorithm`; # lzma -set global innodb_compression_algorithm = 4; +set global innodb_compression_algorithm = lzma; -create table innodb_compressed(c1 int, b char(20)) engine=innodb row_format=compressed key_block_size=8; -show warnings; -create table innodb_normal (c1 int, b char(20)) engine=innodb; -show warnings; -create table innodb_page_compressed1 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=1; -show warnings; -show create table innodb_page_compressed1; -create table innodb_page_compressed2 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=2; -show warnings; -show create table innodb_page_compressed2; -create table innodb_page_compressed3 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=3; -show warnings; -show create table innodb_page_compressed3; -create table innodb_page_compressed4 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=4; -show warnings; -show create table innodb_page_compressed4; -create table innodb_page_compressed5 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=5; -show warnings; -show create table innodb_page_compressed5; -create table innodb_page_compressed6 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=6; -show warnings; -show create table innodb_page_compressed6; -create table innodb_page_compressed7 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=7; -show warnings; -show create table innodb_page_compressed7; -create table innodb_page_compressed8 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=8; -show warnings; -show create table innodb_page_compressed8; -create table innodb_page_compressed9 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=9; -show warnings; -show create table innodb_page_compressed9; -delimiter //; -create procedure innodb_insert_proc (repeat_count int) -begin - declare current_num int; - set current_num = 0; - while current_num < repeat_count do - insert into innodb_normal values(current_num,'testing..'); - set current_num = current_num + 1; - end while; -end// -delimiter ;// -commit; +# All page compression tests use the same +--source include/innodb-page-compression.inc -set autocommit=0; -call innodb_insert_proc(5000); -commit; -set autocommit=1; -select count(*) from innodb_normal; -insert into innodb_compressed select * from innodb_normal; -insert into innodb_page_compressed1 select * from innodb_normal; -insert into innodb_page_compressed2 select * from innodb_normal; -insert into innodb_page_compressed3 select * from innodb_normal; -insert into innodb_page_compressed4 select * from innodb_normal; -insert into innodb_page_compressed5 select * from innodb_normal; -insert into innodb_page_compressed6 select * from innodb_normal; -insert into innodb_page_compressed7 select * from innodb_normal; -insert into innodb_page_compressed8 select * from innodb_normal; -insert into innodb_page_compressed9 select * from innodb_normal; -commit; -select count(*) from innodb_compressed; -select count(*) from innodb_page_compressed1; -select count(*) from innodb_page_compressed1 where c1 < 500000; -select count(*) from innodb_page_compressed2 where c1 < 500000; -select count(*) from innodb_page_compressed3 where c1 < 500000; -select count(*) from innodb_page_compressed4 where c1 < 500000; -select count(*) from innodb_page_compressed5 where c1 < 500000; -select count(*) from innodb_page_compressed6 where c1 < 500000; -select count(*) from innodb_page_compressed7 where c1 < 500000; -select count(*) from innodb_page_compressed8 where c1 < 500000; -select count(*) from innodb_page_compressed9 where c1 < 500000; - -alter table innodb_normal page_compressed=1 page_compression_level=8; -show warnings; -show create table innodb_normal; -alter table innodb_compressed row_format=default page_compressed=1 page_compression_level=8 key_block_size=0; -show warnings; -show create table innodb_compressed; - -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -select count(*) from innodb_compressed; -select count(*) from innodb_page_compressed1; -select count(*) from innodb_page_compressed1 where c1 < 500000; -select count(*) from innodb_page_compressed2 where c1 < 500000; -select count(*) from innodb_page_compressed3 where c1 < 500000; -select count(*) from innodb_page_compressed4 where c1 < 500000; -select count(*) from innodb_page_compressed5 where c1 < 500000; -select count(*) from innodb_page_compressed6 where c1 < 500000; -select count(*) from innodb_page_compressed7 where c1 < 500000; -select count(*) from innodb_page_compressed8 where c1 < 500000; -select count(*) from innodb_page_compressed9 where c1 < 500000; - ---source include/restart_mysqld.inc - -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -select count(*) from innodb_compressed; -select count(*) from innodb_page_compressed1; -select count(*) from innodb_page_compressed1 where c1 < 500000; -select count(*) from innodb_page_compressed2 where c1 < 500000; -select count(*) from innodb_page_compressed3 where c1 < 500000; -select count(*) from innodb_page_compressed4 where c1 < 500000; -select count(*) from innodb_page_compressed5 where c1 < 500000; -select count(*) from innodb_page_compressed6 where c1 < 500000; -select count(*) from innodb_page_compressed7 where c1 < 500000; -select count(*) from innodb_page_compressed8 where c1 < 500000; -select count(*) from innodb_page_compressed9 where c1 < 500000; - -# zlib -set global innodb_compression_algorithm = 1; -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -commit; -select count(*) from innodb_compressed; -select count(*) from innodb_page_compressed1; -select count(*) from innodb_page_compressed1 where c1 < 500000; -select count(*) from innodb_page_compressed2 where c1 < 500000; -select count(*) from innodb_page_compressed3 where c1 < 500000; -select count(*) from innodb_page_compressed4 where c1 < 500000; -select count(*) from innodb_page_compressed5 where c1 < 500000; -select count(*) from innodb_page_compressed6 where c1 < 500000; -select count(*) from innodb_page_compressed7 where c1 < 500000; -select count(*) from innodb_page_compressed8 where c1 < 500000; -select count(*) from innodb_page_compressed9 where c1 < 500000; - ---source include/restart_mysqld.inc - -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -select count(*) from innodb_compressed; -select count(*) from innodb_page_compressed1; -select count(*) from innodb_page_compressed1 where c1 < 500000; -select count(*) from innodb_page_compressed2 where c1 < 500000; -select count(*) from innodb_page_compressed3 where c1 < 500000; -select count(*) from innodb_page_compressed4 where c1 < 500000; -select count(*) from innodb_page_compressed5 where c1 < 500000; -select count(*) from innodb_page_compressed6 where c1 < 500000; -select count(*) from innodb_page_compressed7 where c1 < 500000; -select count(*) from innodb_page_compressed8 where c1 < 500000; -select count(*) from innodb_page_compressed9 where c1 < 500000; - -# none -set global innodb_compression_algorithm = 0; -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -commit; -select count(*) from innodb_compressed; -select count(*) from innodb_page_compressed1; -select count(*) from innodb_page_compressed1 where c1 < 500000; -select count(*) from innodb_page_compressed2 where c1 < 500000; -select count(*) from innodb_page_compressed3 where c1 < 500000; -select count(*) from innodb_page_compressed4 where c1 < 500000; -select count(*) from innodb_page_compressed5 where c1 < 500000; -select count(*) from innodb_page_compressed6 where c1 < 500000; -select count(*) from innodb_page_compressed7 where c1 < 500000; -select count(*) from innodb_page_compressed8 where c1 < 500000; -select count(*) from innodb_page_compressed9 where c1 < 500000; - ---source include/restart_mysqld.inc - -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -select count(*) from innodb_compressed; -select count(*) from innodb_page_compressed1; -select count(*) from innodb_page_compressed1 where c1 < 500000; -select count(*) from innodb_page_compressed2 where c1 < 500000; -select count(*) from innodb_page_compressed3 where c1 < 500000; -select count(*) from innodb_page_compressed4 where c1 < 500000; -select count(*) from innodb_page_compressed5 where c1 < 500000; -select count(*) from innodb_page_compressed6 where c1 < 500000; -select count(*) from innodb_page_compressed7 where c1 < 500000; -select count(*) from innodb_page_compressed8 where c1 < 500000; -select count(*) from innodb_page_compressed9 where c1 < 500000; - -drop procedure innodb_insert_proc; -drop table innodb_normal; -drop table innodb_compressed; -drop table innodb_page_compressed1; -drop table innodb_page_compressed2; -drop table innodb_page_compressed3; -drop table innodb_page_compressed4; -drop table innodb_page_compressed5; -drop table innodb_page_compressed6; -drop table innodb_page_compressed7; -drop table innodb_page_compressed8; -drop table innodb_page_compressed9; +--echo #done # reset system --disable_query_log diff --git a/mysql-test/suite/innodb/t/innodb-page_compression_lzo.test b/mysql-test/suite/innodb/t/innodb-page_compression_lzo.test index 65c7e5dd3d9..451cd4358b2 100644 --- a/mysql-test/suite/innodb/t/innodb-page_compression_lzo.test +++ b/mysql-test/suite/innodb/t/innodb-page_compression_lzo.test @@ -2,195 +2,18 @@ -- source include/have_innodb_lzo.inc -- source include/not_embedded.inc -let $innodb_compression_algorithm_orig=`select @@innodb_compression_algorithm`; +let $innodb_compression_algorithm_orig=`SELECT @@innodb_compression_algorithm`; # lzo -set global innodb_compression_algorithm = 3; +set global innodb_compression_algorithm = lzo; +select @@innodb_compression_algorithm; -create table innodb_compressed(c1 int, b char(20)) engine=innodb row_format=compressed key_block_size=8; -show warnings; -create table innodb_normal (c1 int, b char(20)) engine=innodb; -show warnings; -create table innodb_page_compressed1 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=1; -show warnings; -show create table innodb_page_compressed1; -create table innodb_page_compressed2 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=2; -show warnings; -show create table innodb_page_compressed2; -create table innodb_page_compressed3 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=3; -show warnings; -show create table innodb_page_compressed3; -create table innodb_page_compressed4 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=4; -show warnings; -show create table innodb_page_compressed4; -create table innodb_page_compressed5 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=5; -show warnings; -show create table innodb_page_compressed5; -create table innodb_page_compressed6 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=6; -show warnings; -show create table innodb_page_compressed6; -create table innodb_page_compressed7 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=7; -show warnings; -show create table innodb_page_compressed7; -create table innodb_page_compressed8 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=8; -show warnings; -show create table innodb_page_compressed8; -create table innodb_page_compressed9 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=9; -show warnings; -show create table innodb_page_compressed9; -delimiter //; -create procedure innodb_insert_proc (repeat_count int) -begin - declare current_num int; - set current_num = 0; - while current_num < repeat_count do - insert into innodb_normal values(current_num,'testing..'); - set current_num = current_num + 1; - end while; -end// -delimiter ;// -commit; +# All page compression tests use the same +--source include/innodb-page-compression.inc -set autocommit=0; -call innodb_insert_proc(5000); -commit; -set autocommit=1; -select count(*) from innodb_normal; -insert into innodb_compressed select * from innodb_normal; -insert into innodb_page_compressed1 select * from innodb_normal; -insert into innodb_page_compressed2 select * from innodb_normal; -insert into innodb_page_compressed3 select * from innodb_normal; -insert into innodb_page_compressed4 select * from innodb_normal; -insert into innodb_page_compressed5 select * from innodb_normal; -insert into innodb_page_compressed6 select * from innodb_normal; -insert into innodb_page_compressed7 select * from innodb_normal; -insert into innodb_page_compressed8 select * from innodb_normal; -insert into innodb_page_compressed9 select * from innodb_normal; -commit; -select count(*) from innodb_compressed; -select count(*) from innodb_page_compressed1; -select count(*) from innodb_page_compressed1 where c1 < 500000; -select count(*) from innodb_page_compressed2 where c1 < 500000; -select count(*) from innodb_page_compressed3 where c1 < 500000; -select count(*) from innodb_page_compressed4 where c1 < 500000; -select count(*) from innodb_page_compressed5 where c1 < 500000; -select count(*) from innodb_page_compressed6 where c1 < 500000; -select count(*) from innodb_page_compressed7 where c1 < 500000; -select count(*) from innodb_page_compressed8 where c1 < 500000; -select count(*) from innodb_page_compressed9 where c1 < 500000; - -alter table innodb_normal page_compressed=1 page_compression_level=8; -show warnings; -show create table innodb_normal; -alter table innodb_compressed row_format=default page_compressed=1 page_compression_level=8 key_block_size=0; -show warnings; -show create table innodb_compressed; - -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -select count(*) from innodb_compressed; -select count(*) from innodb_page_compressed1; -select count(*) from innodb_page_compressed1 where c1 < 500000; -select count(*) from innodb_page_compressed2 where c1 < 500000; -select count(*) from innodb_page_compressed3 where c1 < 500000; -select count(*) from innodb_page_compressed4 where c1 < 500000; -select count(*) from innodb_page_compressed5 where c1 < 500000; -select count(*) from innodb_page_compressed6 where c1 < 500000; -select count(*) from innodb_page_compressed7 where c1 < 500000; -select count(*) from innodb_page_compressed8 where c1 < 500000; -select count(*) from innodb_page_compressed9 where c1 < 500000; - ---source include/restart_mysqld.inc - -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -select count(*) from innodb_compressed; -select count(*) from innodb_page_compressed1; -select count(*) from innodb_page_compressed1 where c1 < 500000; -select count(*) from innodb_page_compressed2 where c1 < 500000; -select count(*) from innodb_page_compressed3 where c1 < 500000; -select count(*) from innodb_page_compressed4 where c1 < 500000; -select count(*) from innodb_page_compressed5 where c1 < 500000; -select count(*) from innodb_page_compressed6 where c1 < 500000; -select count(*) from innodb_page_compressed7 where c1 < 500000; -select count(*) from innodb_page_compressed8 where c1 < 500000; -select count(*) from innodb_page_compressed9 where c1 < 500000; - -# zlib -set global innodb_compression_algorithm = 1; -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -commit; -select count(*) from innodb_compressed; -select count(*) from innodb_page_compressed1; -select count(*) from innodb_page_compressed1 where c1 < 500000; -select count(*) from innodb_page_compressed2 where c1 < 500000; -select count(*) from innodb_page_compressed3 where c1 < 500000; -select count(*) from innodb_page_compressed4 where c1 < 500000; -select count(*) from innodb_page_compressed5 where c1 < 500000; -select count(*) from innodb_page_compressed6 where c1 < 500000; -select count(*) from innodb_page_compressed7 where c1 < 500000; -select count(*) from innodb_page_compressed8 where c1 < 500000; -select count(*) from innodb_page_compressed9 where c1 < 500000; - ---source include/restart_mysqld.inc - -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -select count(*) from innodb_compressed; -select count(*) from innodb_page_compressed1; -select count(*) from innodb_page_compressed1 where c1 < 500000; -select count(*) from innodb_page_compressed2 where c1 < 500000; -select count(*) from innodb_page_compressed3 where c1 < 500000; -select count(*) from innodb_page_compressed4 where c1 < 500000; -select count(*) from innodb_page_compressed5 where c1 < 500000; -select count(*) from innodb_page_compressed6 where c1 < 500000; -select count(*) from innodb_page_compressed7 where c1 < 500000; -select count(*) from innodb_page_compressed8 where c1 < 500000; -select count(*) from innodb_page_compressed9 where c1 < 500000; - -drop procedure innodb_insert_proc; -drop table innodb_normal; -drop table innodb_compressed; -drop table innodb_page_compressed1; -drop table innodb_page_compressed2; -drop table innodb_page_compressed3; -drop table innodb_page_compressed4; -drop table innodb_page_compressed5; -drop table innodb_page_compressed6; -drop table innodb_page_compressed7; -drop table innodb_page_compressed8; -drop table innodb_page_compressed9; +-- echo #done # reset system --disable_query_log -eval set global innodb_compression_algorithm = $innodb_compression_algorithm_orig; +EVAL SET GLOBAL innodb_compression_algorithm = $innodb_compression_algorithm_orig; --enable_query_log diff --git a/mysql-test/suite/innodb/t/innodb-page_compression_snappy.test b/mysql-test/suite/innodb/t/innodb-page_compression_snappy.test index 532ec294d28..a2b0526c7d1 100644 --- a/mysql-test/suite/innodb/t/innodb-page_compression_snappy.test +++ b/mysql-test/suite/innodb/t/innodb-page_compression_snappy.test @@ -4,10 +4,18 @@ call mtr.add_suppression("InnoDB: Compression failed for space [0-9]+ name test/innodb_page_compressed[0-9] len [0-9]+ err 2 write_size [0-9]+."); +let $innodb_compression_algorithm_orig=`SELECT @@innodb_compression_algorithm`; + # snappy set global innodb_compression_algorithm = snappy; +select @@innodb_compression_algorithm; -# All page compression test use the same +# All page compression tests use the same --source include/innodb-page-compression.inc -- echo #done + +# reset system +--disable_query_log +EVAL SET GLOBAL innodb_compression_algorithm = $innodb_compression_algorithm_orig; +--enable_query_log diff --git a/mysql-test/suite/innodb/t/innodb-page_compression_zip.test b/mysql-test/suite/innodb/t/innodb-page_compression_zip.test index 0c843314eee..dee75c1f140 100644 --- a/mysql-test/suite/innodb/t/innodb-page_compression_zip.test +++ b/mysql-test/suite/innodb/t/innodb-page_compression_zip.test @@ -4,189 +4,13 @@ let $innodb_compression_algorithm_orig=`SELECT @@innodb_compression_algorithm`; # zlib -set global innodb_compression_algorithm = 1; +set global innodb_compression_algorithm = zlib; +select @@innodb_compression_algorithm; -create table innodb_compressed(c1 int, b char(20)) engine=innodb row_format=compressed key_block_size=8; -show warnings; -create table innodb_normal (c1 int, b char(20)) engine=innodb; -show warnings; -create table innodb_page_compressed1 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=1; -show warnings; -show create table innodb_page_compressed1; -create table innodb_page_compressed2 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=2; -show warnings; -show create table innodb_page_compressed2; -create table innodb_page_compressed3 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=3; -show warnings; -show create table innodb_page_compressed3; -create table innodb_page_compressed4 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=4; -show warnings; -show create table innodb_page_compressed4; -create table innodb_page_compressed5 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=5; -show warnings; -show create table innodb_page_compressed5; -create table innodb_page_compressed6 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=6; -show warnings; -show create table innodb_page_compressed6; -create table innodb_page_compressed7 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=7; -show warnings; -show create table innodb_page_compressed7; -create table innodb_page_compressed8 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=8; -show warnings; -show create table innodb_page_compressed8; -create table innodb_page_compressed9 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=9; -show warnings; -show create table innodb_page_compressed9; -delimiter //; -create procedure innodb_insert_proc (repeat_count int) -begin - declare current_num int; - set current_num = 0; - while current_num < repeat_count do - insert into innodb_normal values(current_num,'testing..'); - set current_num = current_num + 1; - end while; -end// -delimiter ;// -commit; +# All page compression tests use the same +--source include/innodb-page-compression.inc -set autocommit=0; -call innodb_insert_proc(5000); -commit; -set autocommit=1; -select count(*) from innodb_normal; -insert into innodb_compressed select * from innodb_normal; -insert into innodb_page_compressed1 select * from innodb_normal; -insert into innodb_page_compressed2 select * from innodb_normal; -insert into innodb_page_compressed3 select * from innodb_normal; -insert into innodb_page_compressed4 select * from innodb_normal; -insert into innodb_page_compressed5 select * from innodb_normal; -insert into innodb_page_compressed6 select * from innodb_normal; -insert into innodb_page_compressed7 select * from innodb_normal; -insert into innodb_page_compressed8 select * from innodb_normal; -insert into innodb_page_compressed9 select * from innodb_normal; -commit; -select count(*) from innodb_compressed; -select count(*) from innodb_page_compressed1; -select count(*) from innodb_page_compressed1 where c1 < 500000; -select count(*) from innodb_page_compressed2 where c1 < 500000; -select count(*) from innodb_page_compressed3 where c1 < 500000; -select count(*) from innodb_page_compressed4 where c1 < 500000; -select count(*) from innodb_page_compressed5 where c1 < 500000; -select count(*) from innodb_page_compressed6 where c1 < 500000; -select count(*) from innodb_page_compressed7 where c1 < 500000; -select count(*) from innodb_page_compressed8 where c1 < 500000; -select count(*) from innodb_page_compressed9 where c1 < 500000; - -alter table innodb_normal page_compressed=1 page_compression_level=8; -show warnings; -show create table innodb_normal; -alter table innodb_compressed row_format=default page_compressed=1 page_compression_level=8 key_block_size=0; -show warnings; -show create table innodb_compressed; - -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -select count(*) from innodb_compressed; -select count(*) from innodb_page_compressed1; -select count(*) from innodb_page_compressed1 where c1 < 500000; -select count(*) from innodb_page_compressed2 where c1 < 500000; -select count(*) from innodb_page_compressed3 where c1 < 500000; -select count(*) from innodb_page_compressed4 where c1 < 500000; -select count(*) from innodb_page_compressed5 where c1 < 500000; -select count(*) from innodb_page_compressed6 where c1 < 500000; -select count(*) from innodb_page_compressed7 where c1 < 500000; -select count(*) from innodb_page_compressed8 where c1 < 500000; -select count(*) from innodb_page_compressed9 where c1 < 500000; - ---source include/restart_mysqld.inc - -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -select count(*) from innodb_compressed; -select count(*) from innodb_page_compressed1; -select count(*) from innodb_page_compressed1 where c1 < 500000; -select count(*) from innodb_page_compressed2 where c1 < 500000; -select count(*) from innodb_page_compressed3 where c1 < 500000; -select count(*) from innodb_page_compressed4 where c1 < 500000; -select count(*) from innodb_page_compressed5 where c1 < 500000; -select count(*) from innodb_page_compressed6 where c1 < 500000; -select count(*) from innodb_page_compressed7 where c1 < 500000; -select count(*) from innodb_page_compressed8 where c1 < 500000; -select count(*) from innodb_page_compressed9 where c1 < 500000; - -# none -set global innodb_compression_algorithm = 0; -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -commit; -select count(*) from innodb_compressed; -select count(*) from innodb_page_compressed1; -select count(*) from innodb_page_compressed1 where c1 < 500000; -select count(*) from innodb_page_compressed2 where c1 < 500000; -select count(*) from innodb_page_compressed3 where c1 < 500000; -select count(*) from innodb_page_compressed4 where c1 < 500000; -select count(*) from innodb_page_compressed5 where c1 < 500000; -select count(*) from innodb_page_compressed6 where c1 < 500000; -select count(*) from innodb_page_compressed7 where c1 < 500000; -select count(*) from innodb_page_compressed8 where c1 < 500000; -select count(*) from innodb_page_compressed9 where c1 < 500000; ---source include/restart_mysqld.inc - -update innodb_page_compressed1 set c1 = c1 + 1; -update innodb_page_compressed2 set c1 = c1 + 1; -update innodb_page_compressed3 set c1 = c1 + 1; -update innodb_page_compressed4 set c1 = c1 + 1; -update innodb_page_compressed5 set c1 = c1 + 1; -update innodb_page_compressed6 set c1 = c1 + 1; -update innodb_page_compressed7 set c1 = c1 + 1; -update innodb_page_compressed8 set c1 = c1 + 1; -update innodb_page_compressed9 set c1 = c1 + 1; -select count(*) from innodb_compressed; -select count(*) from innodb_page_compressed1; -select count(*) from innodb_page_compressed1 where c1 < 500000; -select count(*) from innodb_page_compressed2 where c1 < 500000; -select count(*) from innodb_page_compressed3 where c1 < 500000; -select count(*) from innodb_page_compressed4 where c1 < 500000; -select count(*) from innodb_page_compressed5 where c1 < 500000; -select count(*) from innodb_page_compressed6 where c1 < 500000; -select count(*) from innodb_page_compressed7 where c1 < 500000; -select count(*) from innodb_page_compressed8 where c1 < 500000; -select count(*) from innodb_page_compressed9 where c1 < 500000; - -drop procedure innodb_insert_proc; -drop table innodb_normal; -drop table innodb_compressed; -drop table innodb_page_compressed1; -drop table innodb_page_compressed2; -drop table innodb_page_compressed3; -drop table innodb_page_compressed4; -drop table innodb_page_compressed5; -drop table innodb_page_compressed6; -drop table innodb_page_compressed7; -drop table innodb_page_compressed8; -drop table innodb_page_compressed9; +-- echo #done # reset system --disable_query_log diff --git a/mysql-test/suite/innodb/t/innodb_bug14147491.test b/mysql-test/suite/innodb/t/innodb_bug14147491.test index d8f0cc6d4b6..b01d067311b 100644 --- a/mysql-test/suite/innodb/t/innodb_bug14147491.test +++ b/mysql-test/suite/innodb/t/innodb_bug14147491.test @@ -66,7 +66,7 @@ EOF --echo # Now t1 is corrupted but we should not crash ---error 1030,1712,1932 +--error ER_GET_ERRNO,ER_INDEX_CORRUPT,ER_NO_SUCH_TABLE_IN_ENGINE,ER_NOT_KEYFILE SELECT * FROM t1; --error 126,1030,1034,1712,1932 diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index 07d3f7efe27..5616911c326 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -2,7 +2,7 @@ Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2008, Google Inc. -Copyright (c) 2013, 2017, MariaDB Corporation. +Copyright (c) 2013, 2018, MariaDB Corporation. Portions of this file contain modifications contributed and copyrighted by Google, Inc. Those modifications are gratefully acknowledged and are described @@ -826,25 +826,34 @@ buf_page_is_corrupted( #ifndef UNIV_INNOCHECKSUM DBUG_EXECUTE_IF("buf_page_import_corrupt_failure", return(true); ); #endif - ulint page_type = mach_read_from_2(read_buf + FIL_PAGE_TYPE); - /* We can trust page type if page compression is set on tablespace flags because page compression flag means file must have been created with 10.1 (later than 5.5 code base). In 10.1 page compressed tables do not contain post compression checksum and - FIL_PAGE_END_LSN_OLD_CHKSUM field stored. Note that space can - be null if we are in fil_check_first_page() and first page - is not compressed or encrypted. Page checksum is verified - after decompression (i.e. normally pages are already - decompressed at this stage). */ + FIL_PAGE_END_LSN_OLD_CHKSUM field stored. + + Note that space can be null if we are in fil_check_first_page() but + first page (page 0) is not compressed or encrypted. + + Note that space can be null if we are in Datafile::find_space_id() + and that point pages are not yet decompressed/decrypted. + + Note that for innochecksum.cc we want to know if page is corrupted + using traditional checksum methods even when page type is + compressed or compressed and encrypted. + + Page checksum is verified after decompression (i.e. normally pages + are already decompressed at this stage). */ +#ifndef UNIV_INNOCHECKSUM + ulint page_type = mach_read_from_2(read_buf + FIL_PAGE_TYPE); if ((page_type == FIL_PAGE_PAGE_COMPRESSED || page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED) -#ifndef UNIV_INNOCHECKSUM - && space && FSP_FLAGS_HAS_PAGE_COMPRESSION(space->flags) -#endif - ) { + && (!space + || (space && FSP_FLAGS_HAS_PAGE_COMPRESSION(space->flags)))) + { return(false); } +#endif /* !UNIV_INNOCHECKSUM */ if (!page_size.is_compressed() && memcmp(read_buf + FIL_PAGE_LSN + 4, @@ -1188,8 +1197,10 @@ buf_page_print(const byte* read_buf, const page_size_t& page_size) ib::info() << "Page dump in ascii and hex (" << page_size.physical() << " bytes):"; +#ifdef UNIV_BUF_DEBUG ut_print_buf(stderr, read_buf, page_size.physical()); fputs("\nInnoDB: End of page dump\n", stderr); +#endif if (page_size.is_compressed()) { /* Print compressed page. */ @@ -4349,8 +4360,8 @@ loop: /* Try to set table as corrupted instead of asserting. */ - if (page_id.space() != TRX_SYS_SPACE && - dict_set_corrupted_by_space(page_id.space())) { + if (page_id.space() != TRX_SYS_SPACE) { + dict_set_corrupted_by_space(page_id.space()); return (NULL); } @@ -5818,7 +5829,6 @@ buf_page_check_corrupt(buf_page_t* bpage, fil_space_t* space) still be corrupted if used key does not match. */ still_encrypted = crypt_data && crypt_data->type != CRYPT_SCHEME_UNENCRYPTED - && !bpage->encrypted && fil_space_verify_crypt_checksum( dst_frame, bpage->size, bpage->id.space(), bpage->id.page_no()); @@ -5913,12 +5923,19 @@ buf_page_io_complete(buf_page_t* bpage, bool evict) return DB_TABLESPACE_DELETED; } - buf_page_decrypt_after_read(bpage, space); + dberr_t err = DB_SUCCESS; + + if (!buf_page_decrypt_after_read(bpage, space)) { + err = DB_PAGE_CORRUPTED; + } byte* frame = bpage->zip.data ? bpage->zip.data : reinterpret_cast<buf_block_t*>(bpage)->frame; - dberr_t err; + + if (err != DB_SUCCESS) { + goto database_corrupted; + } if (bpage->zip.data && uncompressed) { my_atomic_addlint(&buf_pool->n_pend_unzip, 1); @@ -7460,10 +7477,14 @@ buf_page_decrypt_after_read(buf_page_t* bpage, fil_space_t* space) ut_d(fil_page_type_validate(dst_frame)); /* decompress using comp_buf to dst_frame */ - fil_decompress_page(slot->comp_buf, - dst_frame, - ulong(size.logical()), - &bpage->write_size); + if (!fil_verify_compression_checksum(dst_frame, + bpage->id.space(), bpage->id.page_no()) + || !fil_decompress_page(slot->comp_buf, + dst_frame, + ulong(size.logical()), + &bpage->write_size)) { + success = false; + } /* Mark this slot as free */ slot->reserved = false; @@ -7507,10 +7528,14 @@ buf_page_decrypt_after_read(buf_page_t* bpage, fil_space_t* space) ut_d(fil_page_type_validate(dst_frame)); /* decompress using comp_buf to dst_frame */ - fil_decompress_page(slot->comp_buf, + if (!fil_verify_compression_checksum(dst_frame, + bpage->id.space(), bpage->id.page_no()) + || !fil_decompress_page(slot->comp_buf, dst_frame, ulong(size.logical()), - &bpage->write_size); + &bpage->write_size)) { + success = false; + } ut_d(fil_page_type_validate(dst_frame)); } diff --git a/storage/innobase/buf/buf0checksum.cc b/storage/innobase/buf/buf0checksum.cc index 4b56cc81e98..9b2766c37b3 100644 --- a/storage/innobase/buf/buf0checksum.cc +++ b/storage/innobase/buf/buf0checksum.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, MariaDB Corporation. +Copyright (c) 2017, 2018, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -29,6 +29,8 @@ Created Aug 11, 2011 Vasil Dimov #include "ut0crc32.h" #include "ut0rnd.h" #include "buf0checksum.h" +#include "mtr0types.h" +#include "mach0data.h" #ifndef UNIV_INNOCHECKSUM #include "srv0srv.h" @@ -147,3 +149,44 @@ buf_checksum_algorithm_name(srv_checksum_algorithm_t algo) ut_error; return(NULL); } + +/** Calculates the CRC32 checksum of a page compressed page. The value is +stored to the page when it is written to a file and also checked for +a match when reading from the file. Checksum is calculated from +actual payload of the compressed page and some header fields. + +@param[in] page buffer page (UNIV_PAGE_SIZE bytes) +@return checksum */ +uint32_t +buf_calc_compressed_crc32( + const byte* page) +{ + /* In page compressed pages compression method is stored to field + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION, thus add it to checksum. + In pages first compressed and then encrypted same field + contains key version after compression. */ + + ulint page_type = mach_read_from_2(page + FIL_PAGE_TYPE); + + ulint header_len = page_type == FIL_PAGE_PAGE_COMPRESSED ? + FIL_PAGE_SPACE_ID - FIL_PAGE_OFFSET : + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION - FIL_PAGE_OFFSET; + + const uint32_t c1 = ut_crc32( + page + FIL_PAGE_OFFSET, + header_len); + + /* Calculate checksum from actual payload including stored size + field. In encrypted case add also compression method field. */ + ulint payload_len = mach_read_from_2(page+FIL_PAGE_DATA)+FIL_PAGE_COMPRESSED_SIZE; + + if (page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED) { + payload_len += FIL_PAGE_COMPRESSION_METHOD_SIZE; + } + + const uint32_t c2 = ut_crc32( + page + FIL_PAGE_DATA, + payload_len); + + return(c1 ^ c2); +} diff --git a/storage/innobase/buf/buf0dblwr.cc b/storage/innobase/buf/buf0dblwr.cc index 2bc3630d3f5..4ac40f0f213 100644 --- a/storage/innobase/buf/buf0dblwr.cc +++ b/storage/innobase/buf/buf0dblwr.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2013, 2017, MariaDB Corporation. +Copyright (c) 2013, 2018, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -522,6 +522,45 @@ buf_dblwr_init_or_load_pages( return(DB_SUCCESS); } +/** Verify post compression checksum and if it matches +decompress page. +@param[in,out] read_buf Page compressed buffer. Result of + decompression is copied here. +@param[in] space_id Tablespace identifier +@param[in] page_no Page offset +@param[in] page_size Actual page size +@return true if both stored post compression checksum matches calculated one +or it is BUF_NO_CHECKSUM_MAGIC and page decompression is succeeds.*/ +static +bool +buf_dblwr_decompress( + byte * read_buf, + ulint space_id, + ulint page_no, + ulint page_size) +{ + bool success = true; + + /* Page is always fist compressed and then encrypted. Here we can + only decompress pages if they are not encrypted. + + For compressed pages verify post compression checksum and if it + matches decompress the page. + + Note that old datafiles have checksum BUF_NO_CHECKSUM_MAGIC and + that value is accepted as correct post compression checksum see + fil_verify_compression_checksum(). + + In that case we hope that compression algorithm can recover from + corrupted input and return a error that is then handled.*/ + if(!fil_verify_compression_checksum(read_buf, space_id, page_no) + || !fil_decompress_page(NULL, read_buf, page_size, NULL)) { + return success = false; + } + + return success; +} + /** Process and remove the double write buffer pages for all tablespaces. */ void buf_dblwr_process() @@ -601,25 +640,24 @@ buf_dblwr_process() const bool is_all_zero = buf_page_is_zeroes( read_buf, page_size); + bool success = true; + if (is_all_zero) { /* We will check if the copy in the doublewrite buffer is valid. If not, we will ignore this page (there should be redo log records to initialize it). */ } else { - if (fil_page_is_compressed_encrypted(read_buf) || - fil_page_is_compressed(read_buf)) { - /* Decompress the page before - validating the checksum. */ - fil_decompress_page( - NULL, read_buf, srv_page_size, - NULL, true); + if (fil_page_is_compressed(read_buf)) { + success = buf_dblwr_decompress(read_buf, + space_id, page_no, srv_page_size); } - if (fil_space_verify_crypt_checksum( - read_buf, page_size, space_id, page_no) - || !buf_page_is_corrupted( - true, read_buf, page_size, space)) { + if (success + && (fil_space_verify_crypt_checksum( + read_buf, page_size, space_id, page_no) + || !buf_page_is_corrupted( + true, read_buf, page_size, space))) { /* The page is good; there is no need to consult the doublewrite buffer. */ continue; @@ -633,17 +671,15 @@ buf_dblwr_process() } /* Next, validate the doublewrite page. */ - if (fil_page_is_compressed_encrypted(page) || - fil_page_is_compressed(page)) { - /* Decompress the page before - validating the checksum. */ - fil_decompress_page( - NULL, page, srv_page_size, NULL, true); + if (fil_page_is_compressed(page)) { + success = buf_dblwr_decompress(page, + space_id, page_no, srv_page_size); } - if (!fil_space_verify_crypt_checksum(page, page_size, + if (!success + || (!fil_space_verify_crypt_checksum(page, page_size, space_id, page_no) - && buf_page_is_corrupted(true, page, page_size, space)) { + && buf_page_is_corrupted(true, page, page_size, space))) { if (!is_all_zero) { ib::warn() << "A doublewrite copy of page " << page_id << " is corrupted."; diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc index b93eb4d6b17..1383b6425a5 100644 --- a/storage/innobase/dict/dict0dict.cc +++ b/storage/innobase/dict/dict0dict.cc @@ -5997,6 +5997,12 @@ dict_set_corrupted_by_space( table = dict_find_single_table_by_space(space_id); if (!table) { +#ifdef UNIV_DEBUG + ib::info() + << "Can't set space " << space_id + << " corrupted as table is not found dict_sys->table_LRU."; + +#endif return(FALSE); } diff --git a/storage/innobase/fil/fil0crypt.cc b/storage/innobase/fil/fil0crypt.cc index 08a832a4cd5..b297b8cef49 100644 --- a/storage/innobase/fil/fil0crypt.cc +++ b/storage/innobase/fil/fil0crypt.cc @@ -1,6 +1,6 @@ /***************************************************************************** Copyright (C) 2013, 2015, Google Inc. All Rights Reserved. -Copyright (c) 2014, 2017, MariaDB Corporation. +Copyright (c) 2014, 2018, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -2555,13 +2555,6 @@ fil_space_verify_crypt_checksum( return(true); } - /* Compressed and encrypted pages do not have checksum. Assume not - corrupted. Page verification happens after decompression in - buf_page_io_complete() using buf_page_is_corrupted(). */ - if (mach_read_from_2(page+FIL_PAGE_TYPE) == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED) { - return (true); - } - uint32 cchecksum1, cchecksum2; /* Calculate checksums */ diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc index 9e31cb8bd81..c6cdf23dd03 100644 --- a/storage/innobase/fil/fil0fil.cc +++ b/storage/innobase/fil/fil0fil.cc @@ -5804,7 +5804,7 @@ fil_iterate( dst, //dst callback.get_page_size(), src, // src - &err); // src + &err); if (err != DB_SUCCESS) { return(err); @@ -5824,8 +5824,10 @@ fil_iterate( /* If the original page is page_compressed, we need to decompress page before we can update it. */ if (page_compressed) { - fil_decompress_page(NULL, dst, ulong(size), - NULL); + if (!fil_decompress_page(NULL, dst, ulong(size), + NULL)) { + return (DB_PAGE_CORRUPTED); + } updated = true; } diff --git a/storage/innobase/fil/fil0pagecompress.cc b/storage/innobase/fil/fil0pagecompress.cc index cddeb6a2d28..c8ec4d60301 100644 --- a/storage/innobase/fil/fil0pagecompress.cc +++ b/storage/innobase/fil/fil0pagecompress.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (C) 2013, 2017, MariaDB Corporation. +Copyright (C) 2013, 2018, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -26,15 +26,20 @@ Updated 14/02/2015 #include "fil0fil.h" #include "fil0pagecompress.h" +#include "mtr0types.h" +#include "mach0data.h" +#include "page0size.h" +#include "buf0buf.h" +#include "buf0checksum.h" +#include "fsp0pagecompress.h" +#ifndef UNIV_INNOCHECKSUM #include <debug_sync.h> #include <my_dbug.h> #include "mem0mem.h" #include "hash0hash.h" #include "os0file.h" -#include "mach0data.h" -#include "buf0buf.h" #include "buf0flu.h" #include "log0recv.h" #include "fsp0fsp.h" @@ -279,8 +284,6 @@ fil_compress_page( /* Set up the page header */ memcpy(out_buf, buf, FIL_PAGE_DATA); - /* Set up the checksum */ - mach_write_to_4(out_buf+FIL_PAGE_SPACE_OR_CHKSUM, BUF_NO_CHECKSUM_MAGIC); /* Set up the compression algorithm */ mach_write_to_8(out_buf+FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION, comp_method); @@ -297,10 +300,13 @@ fil_compress_page( /* Set up the actual payload lenght */ mach_write_to_2(out_buf+FIL_PAGE_DATA, write_size); + /* Set up the checksum */ + mach_write_to_4(out_buf+FIL_PAGE_SPACE_OR_CHKSUM, buf_calc_compressed_crc32(out_buf)); + #ifdef UNIV_DEBUG /* Verify */ ut_ad(fil_page_is_compressed(out_buf) || fil_page_is_compressed_encrypted(out_buf)); - ut_ad(mach_read_from_4(out_buf+FIL_PAGE_SPACE_OR_CHKSUM) == BUF_NO_CHECKSUM_MAGIC); + ut_ad(mach_read_from_4(out_buf+FIL_PAGE_SPACE_OR_CHKSUM) == buf_calc_compressed_crc32(out_buf)); ut_ad(mach_read_from_2(out_buf+FIL_PAGE_DATA) == write_size); ut_ad(mach_read_from_8(out_buf+FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION) == (ulint)comp_method || mach_read_from_2(out_buf+FIL_PAGE_DATA+FIL_PAGE_COMPRESSED_SIZE) == (ulint)comp_method); @@ -314,7 +320,7 @@ fil_compress_page( uncomp_page = static_cast<byte *>(ut_malloc_nokey(UNIV_PAGE_SIZE)); memcpy(comp_page, out_buf, UNIV_PAGE_SIZE); - fil_decompress_page(uncomp_page, comp_page, ulong(len), NULL); + ut_ad(fil_decompress_page(uncomp_page, comp_page, ulong(len), NULL)); if (buf_page_is_corrupted(false, uncomp_page, univ_page_size, space)) { @@ -402,22 +408,25 @@ exit_free: } -/****************************************************************//** +/** For page compressed pages decompress the page after actual read -operation. */ +operation. +@param[in,out] page_buf Preallocated temporal buffer where + compression is done and then copied + to the buffer. +@param[in,out] buf Compressed page and after suggesful + decompression operation uncompressed page + is copied here. +@param[in] len Length of output buffer. +@param[out] write_size Actual payload size of the compressed data. +@return true when operation succeeded or false when failed */ UNIV_INTERN -void +bool fil_decompress_page( -/*================*/ - byte* page_buf, /*!< in: preallocated buffer or NULL */ - byte* buf, /*!< out: buffer from which to read; in aio - this must be appropriately aligned */ - ulong len, /*!< in: length of output buffer.*/ - ulint* write_size, /*!< in/out: Actual payload size of - the compressed data. */ - bool return_error) /*!< in: true if only an error should - be produced when decompression fails. - By default this parameter is false. */ + byte* page_buf, + byte* buf, + ulong len, + ulint* write_size) { int err = 0; ulint actual_size = 0; @@ -441,7 +450,7 @@ fil_decompress_page( break; default: /* The page is not in our format. */ - return; + ut_error; } // If no buffer was given, we need to allocate temporal buffer @@ -452,23 +461,6 @@ fil_decompress_page( in_buf = page_buf; } - /* Before actual decompress, make sure that page type is correct */ - - if (mach_read_from_4(buf+FIL_PAGE_SPACE_OR_CHKSUM) - != BUF_NO_CHECKSUM_MAGIC - || (ptype != FIL_PAGE_PAGE_COMPRESSED - && ptype != FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED)) { - ib::error() << "Corruption: We try to uncompress corrupted " - "page CRC " - << mach_read_from_4(buf+FIL_PAGE_SPACE_OR_CHKSUM) - << " type " << ptype << " len " << len << "."; - - if (return_error) { - goto error_return; - } - ut_error; - } - /* Get compression algorithm */ if (ptype == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED) { compression_alg = static_cast<ib_uint64_t>(mach_read_from_2(buf+FIL_PAGE_DATA+FIL_PAGE_COMPRESSED_SIZE)); @@ -478,17 +470,10 @@ fil_decompress_page( /* Get the actual size of compressed page */ actual_size = mach_read_from_2(buf+FIL_PAGE_DATA); + /* Check if payload size is corrupted */ if (actual_size == 0 || actual_size > UNIV_PAGE_SIZE) { - ib::error() << "Corruption: We try to uncompress corrupted page" - << " actual size: " << actual_size - << " compression method: " - << fil_get_compression_alg_name(compression_alg) - << "."; - if (return_error) { - goto error_return; - } - ut_error; + goto error_return; } /* Store actual payload size of the compressed data. This pointer @@ -506,10 +491,7 @@ fil_decompress_page( /* If uncompress fails it means that page is corrupted */ if (err != Z_OK) { - goto err_exit; - if (return_error) { - goto error_return; - } + goto error_return; } break; @@ -518,10 +500,7 @@ fil_decompress_page( err = LZ4_decompress_fast((const char *)buf+header_len, (char *)in_buf, len); if (err != (int)actual_size) { - goto err_exit; - if (return_error) { - goto error_return; - } + goto error_return; } break; #endif /* HAVE_LZ4 */ @@ -536,10 +515,7 @@ fil_decompress_page( if (err != LZO_E_OK || (olen == 0 || olen > UNIV_PAGE_SIZE)) { len = olen; - goto err_exit; - if (return_error) { - goto error_return; - } + goto error_return; } break; } @@ -566,10 +542,7 @@ fil_decompress_page( if (ret != LZMA_OK || (dst_pos == 0 || dst_pos > UNIV_PAGE_SIZE)) { len = dst_pos; - goto err_exit; - if (return_error) { - goto error_return; - } + goto error_return; } break; @@ -589,10 +562,7 @@ fil_decompress_page( if (err != BZ_OK || (dst_pos == 0 || dst_pos > UNIV_PAGE_SIZE)) { len = dst_pos; - goto err_exit; - if (return_error) { - goto error_return; - } + goto error_return; } break; } @@ -612,20 +582,14 @@ fil_decompress_page( if (cstatus != SNAPPY_OK || (olen == 0 || olen > UNIV_PAGE_SIZE)) { err = (int)cstatus; len = olen; - goto err_exit; - if (return_error) { - goto error_return; - } + goto error_return; } break; } #endif /* HAVE_SNAPPY */ default: - goto err_exit; - if (return_error) { - goto error_return; - } + goto error_return; break; } @@ -635,14 +599,17 @@ fil_decompress_page( really any other options. */ memcpy(buf, in_buf, len); -error_return: if (page_buf != in_buf) { ut_free(in_buf); } - return; + return true; + +error_return: + if (page_buf != in_buf) { + ut_free(in_buf); + } -err_exit: /* Note that as we have found the page is corrupted, so all this could be incorrect. */ ulint space_id = mach_read_from_4(buf+FIL_PAGE_SPACE_ID); @@ -657,7 +624,71 @@ err_exit: << " compression method: " << fil_get_compression_alg_name(compression_alg) << "."; - buf_page_print(buf, univ_page_size); fil_space_release_for_io(space); - ut_ad(0); + + return false; +} +#endif /* !UNIV_INNOCHECKSUM */ + +/** +Verify that stored post compression checksum matches calculated +checksum. Note that old format did not have a checksum and +in that case either original pre-compression page checksum will +fail after decompression or page decompression fails. + +@param[in,out] page page frame +@param[in] space_id Tablespace identifier +@param[in] offset Page offset +@return true if post compression checksum matches, false otherwise */ +#ifndef UNIV_INNOCHECKSUM +UNIV_INTERN +#endif +bool +fil_verify_compression_checksum( + const byte* page, + ulint space_id, + ulint offset) +{ + ut_ad(page && + (mach_read_from_2(page+FIL_PAGE_TYPE) == FIL_PAGE_PAGE_COMPRESSED + || mach_read_from_2(page+FIL_PAGE_TYPE) == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED)); + + uint32_t checksum = mach_read_from_4(page+FIL_PAGE_SPACE_OR_CHKSUM); + + /* In earlier versions supporting page compression, page compression + stored BUF_NO_CHECKSUM_MAGIC to checksum filed. These pages are + treaded as not corrupted. */ + if (checksum == BUF_NO_CHECKSUM_MAGIC) { + return (true); + } + + uint32_t cchecksum = buf_calc_compressed_crc32(page); + + if (checksum != cchecksum) { + ulint comp_method = mach_read_from_2(page+FIL_PAGE_TYPE) == FIL_PAGE_PAGE_COMPRESSED + ? static_cast<ulint>(mach_read_from_8(page+FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION)) + : mach_read_from_2(page+FIL_PAGE_DATA+FIL_PAGE_COMPRESSED_SIZE); + +#ifdef UNIV_INNOCHECKSUM + fprintf(log_file ? log_file : stderr, + "Page " ULINTPF ":" ULINTPF " may be corrupted." + " Post compression checksum %u" + " stored %u compression_method %s\n", + space_id, offset, checksum, cchecksum, + fil_get_compression_alg_name(comp_method)); +#else /*! UNIV_INNOCHECKSUM */ + FilSpace space(space_id, true); + + ib::error() << "Page [page id: space=" << space_id + << ", page number= " << offset << "]" + << " in file " + << (space() ? space()->chain.start->name : "(import)") + << " may be corrupted." + << " Post compression checksum " << checksum + << " stored " << cchecksum + << " compression_method " << fil_get_compression_alg_name(comp_method); +#endif + } + + return (checksum == cchecksum); } diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index a17abf199fe..9efe382e102 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -2107,6 +2107,7 @@ convert_error_code_to_mysql( code should be introduced */ case DB_CORRUPTION: + case DB_PAGE_CORRUPTED: return(HA_ERR_CRASHED); case DB_OUT_OF_FILE_SPACE: @@ -6559,6 +6560,8 @@ no_such_table: space()->chain.start->name); ret_err = HA_ERR_DECRYPTION_FAILED; } + } else if (ib_table->corrupted) { + ret_err = HA_ERR_CRASHED; } dict_table_close(ib_table, FALSE, FALSE); diff --git a/storage/innobase/include/buf0checksum.h b/storage/innobase/include/buf0checksum.h index 20955a5b2e6..e8cd9f6c9cc 100644 --- a/storage/innobase/include/buf0checksum.h +++ b/storage/innobase/include/buf0checksum.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, MariaDB Corporation. +Copyright (c) 2017, 2018, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -73,4 +73,15 @@ buf_checksum_algorithm_name(srv_checksum_algorithm_t algo); extern ulong srv_checksum_algorithm; extern bool legacy_big_endian_checksum; +/** Calculates the CRC32 checksum of a page compressed page. The value is +stored to the page when it is written to a file and also checked for +a match when reading from the file. Checksum is calculated from +actual payload of the compressed page and some header fields. + +@param[in] page buffer page (UNIV_PAGE_SIZE bytes) +@return checksum */ +uint32_t +buf_calc_compressed_crc32( + const byte* page); + #endif /* buf0checksum_h */ diff --git a/storage/innobase/include/fil0pagecompress.h b/storage/innobase/include/fil0pagecompress.h index be10f99d0f0..f6c6a794db3 100644 --- a/storage/innobase/include/fil0pagecompress.h +++ b/storage/innobase/include/fil0pagecompress.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (C) 2013, 2017 MariaDB Corporation. All Rights Reserved. +Copyright (C) 2013, 2018 MariaDB Corporation. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -19,6 +19,8 @@ this program; if not, write to the Free Software Foundation, Inc., #ifndef fil0pagecompress_h #define fil0pagecompress_h +#ifndef UNIV_INNOCHECKSUM + #include "fsp0fsp.h" #include "fsp0pagecompress.h" @@ -49,21 +51,45 @@ fil_compress_page( ulint* out_len); /*!< out: actual length of compressed page */ -/****************************************************************//** +/** For page compressed pages decompress the page after actual read -operation. */ +operation. +@param[in,out] page_buf Preallocated temporal buffer where + compression is done and then copied + to the buffer. +@param[in,out] buf Compressed page and after suggesful + decompression operation uncompressed page + is copied here. +@param[in] len Length of output buffer. +@param[out] write_size Actual payload size of the compressed data. +@return true when operation succeeded or false when failed */ UNIV_INTERN -void +bool fil_decompress_page( -/*================*/ - byte* page_buf, /*!< in: preallocated buffer or NULL */ - byte* buf, /*!< out: buffer from which to read; in aio - this must be appropriately aligned */ - ulong len, /*!< in: length of output buffer.*/ - ulint* write_size, /*!< in/out: Actual payload size of - the compressed data. */ - bool return_error=false); - /*!< in: true if only an error should - be produced when decompression fails. - By default this parameter is false. */ -#endif + byte* page_buf, + byte* buf, + ulong len, + ulint* write_size) + MY_ATTRIBUTE((warn_unused_result)); + +#endif /* !UNIV_INNOCHECKSUM */ + +/** +Verify that stored post compression checksum matches calculated +checksum. Note that old format did not have a checksum and +in that case either original pre-compression page checksum will +fail after decompression or page decompression fails. + +@param[in,out] page page frame +@param[in] space_id Tablespace identifier +@param[in] offset Page offset +@return true if post compression checksum matches, false otherwise */ +UNIV_INTERN +bool +fil_verify_compression_checksum( + const byte* page, + ulint space_id, + ulint offset) + MY_ATTRIBUTE((warn_unused_result)); + +#endif /* fil0pagecompress_h */ diff --git a/storage/innobase/include/fsp0pagecompress.h b/storage/innobase/include/fsp0pagecompress.h index a5c76737b3a..c0f8344b18c 100644 --- a/storage/innobase/include/fsp0pagecompress.h +++ b/storage/innobase/include/fsp0pagecompress.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (C) 2013, 2017, MariaDB Corporation. All Rights Reserved. +Copyright (C) 2013, 2018, MariaDB Corporation. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -38,6 +38,7 @@ Created 11/12/2013 Jan Lindström jan.lindstrom@skysql.com #define PAGE_SNAPPY_ALGORITHM 6 #define PAGE_ALGORITHM_LAST PAGE_SNAPPY_ALGORITHM +#ifndef UNIV_INNOCHECKSUM /**********************************************************************//** Reads the page compression level from the first page of a tablespace. @return page compression level, or 0 if uncompressed */ @@ -46,6 +47,7 @@ ulint fsp_header_get_compression_level( /*=============================*/ const page_t* page); /*!< in: first page of a tablespace */ +#endif /* !UNIV_INNOCHECKSUM */ /********************************************************************//** Extract the page compression level from tablespace flags. |