Bug #75126 Add option to disallow cross schema ddl
Submitted: 6 Dec 2014 10:42 Modified: 9 Dec 2014 20:55
Reporter: Daniël van Eeden (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: DDL Severity:S4 (Feature request)
Version:5.6, 5.7 OS:Any
Assigned to: CPU Architecture:Any
Tags: DDL, RBR, replication

[6 Dec 2014 10:42] Daniël van Eeden
Description:
It's easy to break replication (and point in time restore) when the binlog is filtered:

Master and slave are 5.6 with gtid and rbr. 
The master has binlog_ignore_db=staging set.

Then:
CREATE SCHEMA staging;
USE staging
CREATE TABLE test.t1 (id INT);
INSERT INTO test.t1 VALUES(2);

Result on the slave:
Error executing row event: 'Table 'test.t1' doesn't exist'

This is a known limitation and is well documented here:
http://dev.mysql.com/doc/refman/5.6/en/replication-options-binary-log.html#option_mysqld_b...

What I would like is an option to disallow cross-schema DDL.

e.g.:
SET GLOBAL cross_schema_ddl = OFF;
USE test;
INSERT INTO t1 VALUES(1); -- allowed
INSERT INTO test.t1 VALUES(1); -- allowed
INSERT INTO staging.t1 VALUES(1); -- not allowed

This would allow one to filter (very) large staging databases from getting into the binlogs without letting anyone breaking replication.

How to repeat:
Filter RBR binlog without making it easy for another database user to break replication.

Suggested fix:
Add setting to allow/disallow cross schema DDL
[9 Dec 2014 19:27] Sveta Smirnova
Thank you for the reasonable feature request.
[9 Dec 2014 20:55] Daniël van Eeden
Corrected the severity