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>
This commit is contained in:
Kristian Nielsen 2024-11-30 22:41:45 +01:00
parent d13eb66f4f
commit 867b53cf4e
3 changed files with 33 additions and 1 deletions

View file

@ -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

View file

@ -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

View file

@ -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");