From 85c0b49822b0b417d86f4112c3e0eadddb65a850 Mon Sep 17 00:00:00 2001 From: Thirunarayanan Balathandayuthapani Date: Tue, 10 Sep 2019 11:34:38 +0530 Subject: MDEV-20320 Tablespace flags mismatch for full_crc32 format Problem: ======= Tablespace flag mismatch happen when innodb_compression_algorithm set to different value during restart for full_crc32 format. Solution: ======== Remove the innodb_compression_algorithm check while comparing the table flags and tablespace flags stored in page0. --- mysql-test/suite/innodb/r/full_crc32_upgrade.result | 17 +++++++++++++++++ mysql-test/suite/innodb/t/full_crc32_upgrade.test | 13 +++++++++++++ storage/innobase/include/fil0fil.h | 10 ++++++---- 3 files changed, 36 insertions(+), 4 deletions(-) create mode 100644 mysql-test/suite/innodb/r/full_crc32_upgrade.result create mode 100644 mysql-test/suite/innodb/t/full_crc32_upgrade.test diff --git a/mysql-test/suite/innodb/r/full_crc32_upgrade.result b/mysql-test/suite/innodb/r/full_crc32_upgrade.result new file mode 100644 index 00000000000..177f83f66cf --- /dev/null +++ b/mysql-test/suite/innodb/r/full_crc32_upgrade.result @@ -0,0 +1,17 @@ +SET GLOBAL INNODB_COMPRESSION_ALGORITHM = 2; +CREATE TABLE t1(f1 int not null)PAGE_COMPRESSED=1 ENGINE=InnoDB; +INSERT INTO t1 VALUES(1); +# restart: --innodb_checksum_algorithm=full_crc32 --innodb_compression_algorithm=0 +INSERT INTO t1 VALUES(2); +SELECT * FROM t1; +f1 +1 +2 +# restart: --innodb_checksum_algorithm=crc32 --innodb_compression_algorithm=3 +INSERT INTO t1 VALUES(3); +SELECT * FROM t1; +f1 +1 +2 +3 +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/full_crc32_upgrade.test b/mysql-test/suite/innodb/t/full_crc32_upgrade.test new file mode 100644 index 00000000000..426198d0ab1 --- /dev/null +++ b/mysql-test/suite/innodb/t/full_crc32_upgrade.test @@ -0,0 +1,13 @@ +--source include/have_innodb.inc +SET GLOBAL INNODB_COMPRESSION_ALGORITHM = 2; +CREATE TABLE t1(f1 int not null)PAGE_COMPRESSED=1 ENGINE=InnoDB; +INSERT INTO t1 VALUES(1); +let $restart_parameters=--innodb_checksum_algorithm=full_crc32 --innodb_compression_algorithm=0; +--source include/restart_mysqld.inc +INSERT INTO t1 VALUES(2); +SELECT * FROM t1; +let $restart_parameters=--innodb_checksum_algorithm=crc32 --innodb_compression_algorithm=3; +--source include/restart_mysqld.inc +INSERT INTO t1 VALUES(3); +SELECT * FROM t1; +DROP TABLE t1; diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h index 04c7f4f18d1..04b9f09a251 100644 --- a/storage/innobase/include/fil0fil.h +++ b/storage/innobase/include/fil0fil.h @@ -396,9 +396,11 @@ struct fil_space_t { { ut_ad(full_crc32(flags)); + /* Here compression algorithm can vary during restart. + So compare the page size alone. */ if (full_crc32(expected)) { - return get_compression_algo(flags) - == get_compression_algo(expected); + return FSP_FLAGS_FCRC32_GET_PAGE_SSIZE(flags) + == FSP_FLAGS_FCRC32_GET_PAGE_SSIZE(expected); } ulint page_ssize = FSP_FLAGS_FCRC32_GET_PAGE_SSIZE(flags); @@ -412,7 +414,7 @@ struct fil_space_t { return false; } - return is_compressed(expected) == is_compressed(flags); + return true; } /** Whether old tablespace flags match full_crc32 flags. @param[in] flags flags present @@ -438,7 +440,7 @@ struct fil_space_t { return false; } - return is_compressed(expected) == is_compressed(flags); + return true; } /** Whether both fsp flags are equivalent */ static bool is_flags_equal(ulint flags, ulint expected) -- cgit v1.2.1