MDEV-22627 Failing assertion: dict_tf2_is_valid(flags, flags2)

create_table_info_t::innobase_table_flags(): Refuse to create
a PAGE_COMPRESSED table with PAGE_COMPRESSION_LEVEL=0 if also
innodb_compression_level=0.

The parameter value innodb_compression_level=0 was only somewhat
meaningful for testing or debugging ROW_FORMAT=COMPRESSED tables.
For the page_compressed format, it never made any sense, and the
check in dict_tf_is_valid_not_redundant() that was added in
72378a2583 (MDEV-12873) would cause
the server to crash.
This commit is contained in:
Marko Mäkelä 2021-10-20 15:54:25 +03:00
commit b06e8167a7
4 changed files with 55 additions and 9 deletions

View file

@ -20,3 +20,12 @@
SET @save_format = @@GLOBAL.innodb_default_row_format;
SET GLOBAL innodb_default_row_format = redundant;
CREATE TABLE t1 (c1 INT) ENGINE=InnoDB;
@@ -49,7 +49,7 @@
ERROR HY000: Can't create table `test`.`t` (errno: 140 "Wrong create options")
SHOW WARNINGS;
Level Code Message
-Warning 1478 InnoDB: PAGE_COMPRESSED requires PAGE_COMPRESSION_LEVEL or innodb_compression_level > 0
+Warning 140 InnoDB: PAGE_COMPRESSED table can't have ROW_TYPE=REDUNDANT
Error 1005 Can't create table `test`.`t` (errno: 140 "Wrong create options")
Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
CREATE TABLE t(c INT) ENGINE=InnoDB page_compressed=1 page_compression_level=1;

View file

@ -42,3 +42,18 @@ SHOW TABLE STATUS LIKE 't1';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 InnoDB # Redundant # # # # # # NULL # NULL NULL latin1_swedish_ci NULL
DROP TABLE t1;
SET @save_level=@@GLOBAL.innodb_compression_level;
SET GLOBAL innodb_compression_level=0;
CREATE TABLE t(c INT) ENGINE=InnoDB page_compressed=1;
ERROR HY000: Can't create table `test`.`t` (errno: 140 "Wrong create options")
SHOW WARNINGS;
Level Code Message
Warning 1478 InnoDB: PAGE_COMPRESSED requires PAGE_COMPRESSION_LEVEL or innodb_compression_level > 0
Error 1005 Can't create table `test`.`t` (errno: 140 "Wrong create options")
Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
CREATE TABLE t(c INT) ENGINE=InnoDB page_compressed=1 page_compression_level=1;
DROP TABLE IF EXISTS t;
SET GLOBAL innodb_compression_level=1;
CREATE TABLE t(c INT) ENGINE=InnoDB page_compressed=1;
DROP TABLE IF EXISTS t;
SET GLOBAL innodb_compression_level=@save_level;

View file

@ -44,3 +44,19 @@ TRUNCATE TABLE t1;
--replace_column 3 # 5 # 6 # 7 # 8 # 9 # 10 # 12 #
SHOW TABLE STATUS LIKE 't1';
DROP TABLE t1;
SET @save_level=@@GLOBAL.innodb_compression_level;
SET GLOBAL innodb_compression_level=0;
--error ER_CANT_CREATE_TABLE
CREATE TABLE t(c INT) ENGINE=InnoDB page_compressed=1;
SHOW WARNINGS;
--disable_warnings
--error 0,ER_CANT_CREATE_TABLE
CREATE TABLE t(c INT) ENGINE=InnoDB page_compressed=1 page_compression_level=1;
DROP TABLE IF EXISTS t;
SET GLOBAL innodb_compression_level=1;
--error 0,ER_CANT_CREATE_TABLE
CREATE TABLE t(c INT) ENGINE=InnoDB page_compressed=1;
DROP TABLE IF EXISTS t;
--enable_warnings
SET GLOBAL innodb_compression_level=@save_level;