diff --git a/mysql-test/suite/rpl/r/rpl_row_create_table.result b/mysql-test/suite/rpl/r/rpl_row_create_table.result index 197b4be2c9f..8bb229e215d 100644 --- a/mysql-test/suite/rpl/r/rpl_row_create_table.result +++ b/mysql-test/suite/rpl/r/rpl_row_create_table.result @@ -495,5 +495,18 @@ DROP VIEW IF EXISTS bug48506_t1, bug48506_t2, bug48506_t3; DROP TEMPORARY TABLES t7; DROP TABLES t4, t5; DROP TABLES IF EXISTS bug48506_t4; +*** MDEV-31794: Preserved unsupported table flags break replication +CREATE TEMPORARY TABLE t1 (a INT) ENGINE=Aria TRANSACTIONAL=1; +ALTER TABLE t1 ENGINE=MyISAM; +CREATE TABLE t2 LIKE t1; +connection slave; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci /* TRANSACTIONAL=1 */ +connection master; +DROP TEMPORARY TABLE t1; +DROP TABLE t2; include/rpl_end.inc end of the tests diff --git a/mysql-test/suite/rpl/t/rpl_row_create_table.test b/mysql-test/suite/rpl/t/rpl_row_create_table.test index b62955e2cd4..47ad0670a58 100644 --- a/mysql-test/suite/rpl/t/rpl_row_create_table.test +++ b/mysql-test/suite/rpl/t/rpl_row_create_table.test @@ -280,6 +280,25 @@ DROP TEMPORARY TABLES t7; DROP TABLES t4, t5; DROP TABLES IF EXISTS bug48506_t4; + +--echo *** MDEV-31794: Preserved unsupported table flags break replication +CREATE TEMPORARY TABLE t1 (a INT) ENGINE=Aria TRANSACTIONAL=1; +# After ALTER to MyISAM, TRANSACTIONAL=1 is a left-over option normally +# invalid for MyISAM. +ALTER TABLE t1 ENGINE=MyISAM; +# Since row-based binlogging is used, the temporary table t1 is not binlogged, +# so this CREATE TABLE LIKE is replicated as a plain CREATE TABLE which +# specifies invalid TRANSACTIONAL=1 for a MyISAM table. +# Test that the slave will still allow the create table. +CREATE TABLE t2 LIKE t1; +--sync_slave_with_master +SHOW CREATE TABLE t2; + +--connection master +DROP TEMPORARY TABLE t1; +DROP TABLE t2; + + --source include/rpl_end.inc --echo end of the tests diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 0368bfa7194..e5448b23164 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -3855,7 +3855,7 @@ without_overlaps_err: /* Give warnings for not supported table options */ if (create_info->used_fields & HA_CREATE_USED_TRANSACTIONAL && - !file->has_transactional_option()) + !file->has_transactional_option() && !thd->rgi_slave) push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_OPTION, ER_THD(thd, ER_UNKNOWN_OPTION), "transactional");