[PATCH] MDEV-31794: Preserved unsupported table flags break replication
The slave replication should accept not supported table options (eg. "transactional" for MyISAM), as such options can end up being set from the master in binlogged CREATE TABLE. This was already handled in report_unknown_option(), which skips the error in slave threads. But in mysql_prepare_create_table_finalize() there was still a warning given, and this warning gets converted into an error when STRICT_(ALL|TRANS)_TABLES. So skip this warning for replication also. Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org> --- .../suite/rpl/r/rpl_row_create_table.result | 13 +++++++++++++ .../suite/rpl/t/rpl_row_create_table.test | 19 +++++++++++++++++++ sql/sql_table.cc | 2 +- 3 files changed, 33 insertions(+), 1 deletion(-) 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 25ff452c109..51a1d013d19 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -3876,7 +3876,7 @@ mysql_prepare_create_table_finalize(THD *thd, HA_CREATE_INFO *create_info, /* 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"); -- 2.39.5
participants (1)
-
Kristian Nielsen