diff options
author | Thirunarayanan Balathandayuthapani <thiru@mariadb.com> | 2019-09-10 17:41:26 +0530 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2019-09-10 17:41:26 +0530 |
commit | e2f570bff872532dcae5f2cf882e01f40c9aacd2 (patch) | |
tree | 2a3c53445c9a05917a975b554a2f0988870d162e /mysql-test | |
parent | 13f740904a389f03d3c075fee0b91ecfcc0de60b (diff) | |
download | mariadb-git-e2f570bff872532dcae5f2cf882e01f40c9aacd2.tar.gz |
MDEV-20320 Tablespace flags mismatch for full_crc32 format
Files for PAGE_COMPRESSED tables that were created with
innodb_checksum_algorithm=full_crc32 store the value of
innodb_compression_algorithm at the time of the file creation.
The server-wide setting of innodb_compression_algorithm
may be changed after file creation. We must ignore any mismatch
when opening a data file, and for writes, we must use the
choice of algorithm that is stored in the file.
fil_space_t::is_flags_full_crc32_equal(): Ignore the
innodb_compression_algorithm but do compare innodb_page_size.
fil_space_t::is_flags_non_full_crc32_equal(): Ignore the
innodb_compression_algorithm.
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/suite/innodb/r/full_crc32_import.result | 48 | ||||
-rw-r--r-- | mysql-test/suite/innodb/t/full_crc32_import.test | 61 |
2 files changed, 109 insertions, 0 deletions
diff --git a/mysql-test/suite/innodb/r/full_crc32_import.result b/mysql-test/suite/innodb/r/full_crc32_import.result index 693ad22bab6..b8ebbb73706 100644 --- a/mysql-test/suite/innodb/r/full_crc32_import.result +++ b/mysql-test/suite/innodb/r/full_crc32_import.result @@ -127,3 +127,51 @@ Table Op Msg_type Msg_text test.t1 check status OK InnoDB 0 transactions not purged DROP TABLE t1; +SET @save_algo = @@GLOBAL.innodb_compression_algorithm; +SET GLOBAL innodb_compression_algorithm=2; +CREATE TABLE t1(a SERIAL) PAGE_COMPRESSED=1 ENGINE=InnoDB; +INSERT INTO t1 VALUES(1); +FLUSH TABLE t1 FOR EXPORT; +# List before copying files +db.opt +t1.cfg +t1.frm +t1.ibd +backup: t1 +UNLOCK TABLES; +SET GLOBAL innodb_compression_algorithm=0; +ALTER TABLE t1 FORCE; +ALTER TABLE t1 DISCARD TABLESPACE; +db.opt +t1.frm +restore: t1 .ibd and .cfg files +ALTER TABLE t1 IMPORT TABLESPACE; +INSERT INTO t1 VALUES(2); +SELECT * FROM t1; +a +1 +2 +SET GLOBAL innodb_compression_algorithm=3; +FLUSH TABLE t1 FOR EXPORT; +# List before copying files +db.opt +t1.cfg +t1.frm +t1.ibd +backup: t1 +UNLOCK TABLES; +SET GLOBAL innodb_compression_algorithm=0; +ALTER TABLE t1 FORCE; +ALTER TABLE t1 DISCARD TABLESPACE; +db.opt +t1.frm +restore: t1 .ibd and .cfg files +ALTER TABLE t1 IMPORT TABLESPACE; +INSERT INTO t1 VALUES(3); +SELECT * FROM t1; +a +1 +2 +3 +DROP TABLE t1; +SET GLOBAL innodb_compression_algorithm=@save_algo; diff --git a/mysql-test/suite/innodb/t/full_crc32_import.test b/mysql-test/suite/innodb/t/full_crc32_import.test index 3916b52d073..c5b50997a70 100644 --- a/mysql-test/suite/innodb/t/full_crc32_import.test +++ b/mysql-test/suite/innodb/t/full_crc32_import.test @@ -137,3 +137,64 @@ DELETE FROM t1; CHECK TABLE t1; --source include/wait_all_purged.inc DROP TABLE t1; + +SET @save_algo = @@GLOBAL.innodb_compression_algorithm; +SET GLOBAL innodb_compression_algorithm=2; +CREATE TABLE t1(a SERIAL) PAGE_COMPRESSED=1 ENGINE=InnoDB; +INSERT INTO t1 VALUES(1); + +FLUSH TABLE t1 FOR EXPORT; +--echo # List before copying files +let MYSQLD_DATADIR =`SELECT @@datadir`; + +--list_files $MYSQLD_DATADIR/test +perl; +do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; +ib_backup_tablespaces("test", "t1"); +EOF + +UNLOCK TABLES; +SET GLOBAL innodb_compression_algorithm=0; +ALTER TABLE t1 FORCE; +ALTER TABLE t1 DISCARD TABLESPACE; + +--list_files $MYSQLD_DATADIR/test +perl; +do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; +ib_discard_tablespaces("test", "t1"); +ib_restore_tablespaces("test", "t1"); +EOF + +ALTER TABLE t1 IMPORT TABLESPACE; +INSERT INTO t1 VALUES(2); +SELECT * FROM t1; + +SET GLOBAL innodb_compression_algorithm=3; +FLUSH TABLE t1 FOR EXPORT; +--echo # List before copying files +let MYSQLD_DATADIR =`SELECT @@datadir`; + +--list_files $MYSQLD_DATADIR/test +perl; +do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; +ib_backup_tablespaces("test", "t1"); +EOF + +UNLOCK TABLES; +SET GLOBAL innodb_compression_algorithm=0; +ALTER TABLE t1 FORCE; +ALTER TABLE t1 DISCARD TABLESPACE; + +--list_files $MYSQLD_DATADIR/test +perl; +do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; +ib_discard_tablespaces("test", "t1"); +ib_restore_tablespaces("test", "t1"); +EOF + +ALTER TABLE t1 IMPORT TABLESPACE; +INSERT INTO t1 VALUES(3); +SELECT * FROM t1; +DROP TABLE t1; + +SET GLOBAL innodb_compression_algorithm=@save_algo; |