diff --git a/mysql-test/suite/innodb/r/table_flags.result b/mysql-test/suite/innodb/r/table_flags.result index eada084d669..fcf2b68c7f6 100644 --- a/mysql-test/suite/innodb/r/table_flags.result +++ b/mysql-test/suite/innodb/r/table_flags.result @@ -210,3 +210,14 @@ ALTER TABLE t1 PAGE_COMPRESSED = 1; INSERT INTO t1 VALUES(2); # restart DROP TABLE t1; +# +# MDEV-34222 Alter operation on redundant table aborts the server +# +SET @df_row = @@global.INNODB_DEFAULT_ROW_FORMAT; +SET GLOBAL INNODB_DEFAULT_ROW_FORMAT=REDUNDANT; +CREATE TABLE t1 (c CHAR(1)) ENGINE=InnoDB; +SET GLOBAL INNODB_DEFAULT_ROW_FORMAT=compact; +ALTER TABLE t1 PAGE_COMPRESSED=1; +ERROR HY000: Table storage engine 'InnoDB' does not support the create option 'PAGE_COMPRESSED=1 ROW_FORMAT=REDUNDANT' +DROP TABLE t1; +SET @@global.INNODB_DEFAULT_ROW_FORMAT = @df_row; diff --git a/mysql-test/suite/innodb/t/table_flags.test b/mysql-test/suite/innodb/t/table_flags.test index 92ebdda442a..ab3c707af95 100644 --- a/mysql-test/suite/innodb/t/table_flags.test +++ b/mysql-test/suite/innodb/t/table_flags.test @@ -257,3 +257,15 @@ INSERT INTO t1 VALUES(2); let $shutdown_timeout = 0; --source include/restart_mysqld.inc DROP TABLE t1; + +--echo # +--echo # MDEV-34222 Alter operation on redundant table aborts the server +--echo # +SET @df_row = @@global.INNODB_DEFAULT_ROW_FORMAT; +SET GLOBAL INNODB_DEFAULT_ROW_FORMAT=REDUNDANT; +CREATE TABLE t1 (c CHAR(1)) ENGINE=InnoDB; +SET GLOBAL INNODB_DEFAULT_ROW_FORMAT=compact; +--error ER_ILLEGAL_HA_CREATE_OPTION +ALTER TABLE t1 PAGE_COMPRESSED=1; +DROP TABLE t1; +SET @@global.INNODB_DEFAULT_ROW_FORMAT = @df_row; diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index 0c107111b34..ec34b7d1b67 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -8339,6 +8339,15 @@ field_changed: DBUG_RETURN(true); } + if ((ha_alter_info->handler_flags & ALTER_OPTIONS) + && ctx->page_compression_level + && !ctx->old_table->not_redundant()) { + my_error(ER_ILLEGAL_HA_CREATE_OPTION, MYF(0), + table_type(), + "PAGE_COMPRESSED=1 ROW_FORMAT=REDUNDANT"); + DBUG_RETURN(true); + } + if (!(ha_alter_info->handler_flags & INNOBASE_ALTER_DATA) && alter_templ_needs_rebuild(altered_table, ha_alter_info, ctx->new_table)