summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThirunarayanan Balathandayuthapani <thiru@mariadb.com>2019-09-10 11:34:38 +0530
committerThirunarayanan Balathandayuthapani <thiru@mariadb.com>2019-09-10 11:34:38 +0530
commit85c0b49822b0b417d86f4112c3e0eadddb65a850 (patch)
tree0a60c3919868d381bb73073167279f26f2a37089
parente6c114e7a6db87474ed7fdfaf4c55e23663a29b4 (diff)
downloadmariadb-git-bb-10.4-MDEV-20320.tar.gz
MDEV-20320 Tablespace flags mismatch for full_crc32 formatbb-10.4-MDEV-20320
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.
-rw-r--r--mysql-test/suite/innodb/r/full_crc32_upgrade.result17
-rw-r--r--mysql-test/suite/innodb/t/full_crc32_upgrade.test13
-rw-r--r--storage/innobase/include/fil0fil.h10
3 files changed, 36 insertions, 4 deletions
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)