From c913cd2b669f906f17c87b4c0864ae95b3911e03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 12 Dec 2018 16:31:34 +0200 Subject: MDEV-17885 TRUNCATE on temporary table causes ER_GET_ERRNO ha_innobase::truncate(): Because CREATE TEMPORARY TABLE allows invalid table options when innodb_file_per_table=1, do allow them also in TRUNCATE for temporary tables. --- mysql-test/suite/innodb/r/truncate.result | 9 +++++++++ mysql-test/suite/innodb/t/truncate.test | 9 +++++++++ 2 files changed, 18 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/suite/innodb/r/truncate.result b/mysql-test/suite/innodb/r/truncate.result index d3ea2716464..5e9fd60d4fe 100644 --- a/mysql-test/suite/innodb/r/truncate.result +++ b/mysql-test/suite/innodb/r/truncate.result @@ -30,3 +30,12 @@ SELECT * FROM t1; a 1 DROP TABLE t1; +# +# MDEV-17885 TRUNCATE on temporary table causes ER_GET_ERRNO +# +CREATE TEMPORARY TABLE t1 (a INT) ENCRYPTED=NO ENGINE=InnoDB; +INSERT INTO t1 VALUES(1); +TRUNCATE t1; +SELECT * FROM t1; +a +DROP TEMPORARY TABLE t1; diff --git a/mysql-test/suite/innodb/t/truncate.test b/mysql-test/suite/innodb/t/truncate.test index 6c573cf42d4..cd1d827e157 100644 --- a/mysql-test/suite/innodb/t/truncate.test +++ b/mysql-test/suite/innodb/t/truncate.test @@ -41,3 +41,12 @@ CREATE TABLE t1 (a INT) ENGINE=InnoDB; --move_file $MYSQLD_DATADIR/test/hidden.frm $MYSQLD_DATADIR/test/t1.frm SELECT * FROM t1; DROP TABLE t1; + +--echo # +--echo # MDEV-17885 TRUNCATE on temporary table causes ER_GET_ERRNO +--echo # +CREATE TEMPORARY TABLE t1 (a INT) ENCRYPTED=NO ENGINE=InnoDB; +INSERT INTO t1 VALUES(1); +TRUNCATE t1; +SELECT * FROM t1; +DROP TEMPORARY TABLE t1; -- cgit v1.2.1 From e3dda3d95ee4c09c2ed45ce886ecd25d1fc1ae92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 13 Dec 2018 21:25:12 +0200 Subject: MDEV-17989 InnoDB: Failing assertion: dict_tf2_is_valid(flags, flags2) With innodb_default_row_format=redundant, InnoDB would crash when using table options that are incompatible with ROW_FORMAT=REDUNDANT. create_table_info_t::m_default_row_format: Cache the value of innodb_default_row_format. create_table_info_t::check_table_options(): Validate ROW_TYPE_DEFAULT with m_default_row_format. create_table_info_t::innobase_table_flags(): Use the cached m_default_row_format. create_table_info_t: Never read m_form->s->row_type. Use m_create_info->row_type instead. dict_tf_set(): Never set invalid flags for ROW_FORMAT=REDUNDANT. ha_innobase::truncate(): Set info.row_type based on the ROW_FORMAT of the current table. --- .../r/default_row_format_create,redundant.rdiff | 11 +++++++++++ .../innodb/r/default_row_format_create.result | 22 ++++++++++++++++++++-- .../suite/innodb/t/default_row_format_create.test | 20 +++++++++++++++++++- 3 files changed, 50 insertions(+), 3 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/suite/innodb/r/default_row_format_create,redundant.rdiff b/mysql-test/suite/innodb/r/default_row_format_create,redundant.rdiff index 35aa402edd9..29bc560907e 100644 --- a/mysql-test/suite/innodb/r/default_row_format_create,redundant.rdiff +++ b/mysql-test/suite/innodb/r/default_row_format_create,redundant.rdiff @@ -9,3 +9,14 @@ DROP TABLE t1; CREATE TABLE t1(c1 TEXT,c2 BLOB) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; SHOW TABLE STATUS LIKE 't1'; +@@ -31,8 +31,9 @@ + CREATE TABLE t1 (c1 INT) ENGINE=InnoDB page_compressed=1; + 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 # Dynamic # # # # # # NULL # NULL NULL latin1_swedish_ci NULL `page_compressed`=1 + DROP TABLE IF EXISTS t1; ++Warnings: ++Note 1051 Unknown table 'test.t1' + SET @save_format = @@GLOBAL.innodb_default_row_format; + SET GLOBAL innodb_default_row_format = redundant; + CREATE TABLE t1 (c1 INT) ENGINE=InnoDB; diff --git a/mysql-test/suite/innodb/r/default_row_format_create.result b/mysql-test/suite/innodb/r/default_row_format_create.result index e80c1283b37..d51a63dbd01 100644 --- a/mysql-test/suite/innodb/r/default_row_format_create.result +++ b/mysql-test/suite/innodb/r/default_row_format_create.result @@ -19,8 +19,26 @@ Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length I t1 InnoDB # Redundant # # # # # # NULL # NULL NULL latin1_swedish_ci NULL row_format=REDUNDANT DROP TABLE t1; CREATE TABLE t1(c1 TEXT,c2 BLOB) ENGINE=InnoDB -ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1; +ROW_FORMAT=COMPRESSED; 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 # Compressed # # # # # # NULL # NULL NULL latin1_swedish_ci NULL row_format=COMPRESSED key_block_size=1 +t1 InnoDB # Compressed # # # # # # NULL # NULL NULL latin1_swedish_ci NULL row_format=COMPRESSED +TRUNCATE TABLE t1; +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 # Compressed # # # # # # NULL # NULL NULL latin1_swedish_ci NULL row_format=COMPRESSED +DROP TABLE t1; +CREATE TABLE t1 (c1 INT) ENGINE=InnoDB page_compressed=1; +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 # Dynamic # # # # # # NULL # NULL NULL latin1_swedish_ci NULL `page_compressed`=1 +DROP TABLE IF EXISTS t1; +SET @save_format = @@GLOBAL.innodb_default_row_format; +SET GLOBAL innodb_default_row_format = redundant; +CREATE TABLE t1 (c1 INT) ENGINE=InnoDB; +SET GLOBAL innodb_default_row_format = @save_format; +TRUNCATE TABLE t1; +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; diff --git a/mysql-test/suite/innodb/t/default_row_format_create.test b/mysql-test/suite/innodb/t/default_row_format_create.test index e0981abf7eb..03a7ebd3752 100644 --- a/mysql-test/suite/innodb/t/default_row_format_create.test +++ b/mysql-test/suite/innodb/t/default_row_format_create.test @@ -22,7 +22,25 @@ SHOW TABLE STATUS LIKE 't1'; DROP TABLE t1; CREATE TABLE t1(c1 TEXT,c2 BLOB) ENGINE=InnoDB -ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1; +ROW_FORMAT=COMPRESSED; +--replace_column 3 # 5 # 6 # 7 # 8 # 9 # 10 # 12 # +SHOW TABLE STATUS LIKE 't1'; +TRUNCATE TABLE t1; +--replace_column 3 # 5 # 6 # 7 # 8 # 9 # 10 # 12 # +SHOW TABLE STATUS LIKE 't1'; +DROP TABLE t1; + +--error 0,ER_CANT_CREATE_TABLE +CREATE TABLE t1 (c1 INT) ENGINE=InnoDB page_compressed=1; +--replace_column 3 # 5 # 6 # 7 # 8 # 9 # 10 # 12 # +SHOW TABLE STATUS LIKE 't1'; +DROP TABLE IF EXISTS t1; + +SET @save_format = @@GLOBAL.innodb_default_row_format; +SET GLOBAL innodb_default_row_format = redundant; +CREATE TABLE t1 (c1 INT) ENGINE=InnoDB; +SET GLOBAL innodb_default_row_format = @save_format; +TRUNCATE TABLE t1; --replace_column 3 # 5 # 6 # 7 # 8 # 9 # 10 # 12 # SHOW TABLE STATUS LIKE 't1'; DROP TABLE t1; -- cgit v1.2.1