Skip to content

Commit 867b53c

Browse files
committed
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 <[email protected]>
1 parent d13eb66 commit 867b53c

File tree

3 files changed

+33
-1
lines changed

3 files changed

+33
-1
lines changed

mysql-test/suite/rpl/r/rpl_row_create_table.result

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -495,5 +495,18 @@ DROP VIEW IF EXISTS bug48506_t1, bug48506_t2, bug48506_t3;
495495
DROP TEMPORARY TABLES t7;
496496
DROP TABLES t4, t5;
497497
DROP TABLES IF EXISTS bug48506_t4;
498+
*** MDEV-31794: Preserved unsupported table flags break replication
499+
CREATE TEMPORARY TABLE t1 (a INT) ENGINE=Aria TRANSACTIONAL=1;
500+
ALTER TABLE t1 ENGINE=MyISAM;
501+
CREATE TABLE t2 LIKE t1;
502+
connection slave;
503+
SHOW CREATE TABLE t2;
504+
Table Create Table
505+
t2 CREATE TABLE `t2` (
506+
`a` int(11) DEFAULT NULL
507+
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci /* TRANSACTIONAL=1 */
508+
connection master;
509+
DROP TEMPORARY TABLE t1;
510+
DROP TABLE t2;
498511
include/rpl_end.inc
499512
end of the tests

mysql-test/suite/rpl/t/rpl_row_create_table.test

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,25 @@ DROP TEMPORARY TABLES t7;
280280
DROP TABLES t4, t5;
281281
DROP TABLES IF EXISTS bug48506_t4;
282282

283+
284+
--echo *** MDEV-31794: Preserved unsupported table flags break replication
285+
CREATE TEMPORARY TABLE t1 (a INT) ENGINE=Aria TRANSACTIONAL=1;
286+
# After ALTER to MyISAM, TRANSACTIONAL=1 is a left-over option normally
287+
# invalid for MyISAM.
288+
ALTER TABLE t1 ENGINE=MyISAM;
289+
# Since row-based binlogging is used, the temporary table t1 is not binlogged,
290+
# so this CREATE TABLE LIKE is replicated as a plain CREATE TABLE which
291+
# specifies invalid TRANSACTIONAL=1 for a MyISAM table.
292+
# Test that the slave will still allow the create table.
293+
CREATE TABLE t2 LIKE t1;
294+
--sync_slave_with_master
295+
SHOW CREATE TABLE t2;
296+
297+
--connection master
298+
DROP TEMPORARY TABLE t1;
299+
DROP TABLE t2;
300+
301+
283302
--source include/rpl_end.inc
284303

285304
--echo end of the tests

sql/sql_table.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3855,7 +3855,7 @@ mysql_prepare_create_table_finalize(THD *thd, HA_CREATE_INFO *create_info,
38553855

38563856
/* Give warnings for not supported table options */
38573857
if (create_info->used_fields & HA_CREATE_USED_TRANSACTIONAL &&
3858-
!file->has_transactional_option())
3858+
!file->has_transactional_option() && !thd->rgi_slave)
38593859
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_OPTION,
38603860
ER_THD(thd, ER_UNKNOWN_OPTION), "transactional");
38613861

0 commit comments

Comments
 (0)