Bug #80619 Allow slave to filter replication events based on GTID
Submitted: 4 Mar 2016 17:13 Modified: 13 Jun 2016 13:36
Reporter: Valeriy Kravchuk Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Replication Severity:S4 (Feature request)
Version:5.7+ OS:Any
Assigned to: CPU Architecture:Any
Tags: GTID, replicate_wild_do_gtid

[4 Mar 2016 17:13] Valeriy Kravchuk
Description:
I think it would be very useful if slave would be able to skip some of transactions based on GTIDs they have (that is, based on server/domain they originate from, for example).

For this I suggest to add two options:

--replicate-wild-do-gtids=gtids_template

and 

--replicate-wild-ignore-gtids=gtids_template

with semantics somewhat similar to those of replicate-wild-* options (see https://dev.mysql.com/doc/refman/5.7/en/replication-options-slave.html#option_mysqld_repli...).

This way we can add separate option to skip events originating from specific servers (by UUID) or events in specific range of GTIDs, not one by one, but automatically.

How to repeat:
Set up chained replication:

M1 --> S1 --> S2

then make sure S2 slave replicates only transactions originating from M1 master, but not those originating from S1 (as probably they were executed on S1 by mistake by some root/DBA while it was in read_only mode). The idea is to have replication working on S2 without interruptions and influence of intermediate slave S1, no matter what DBA on S1 may execute/change locally.

Alternatively, try to replicate from Galera (or Percona XtraDB Cluster) to async MySQL slave using GTID-based replication. Do some transaction on some node that is NOT replicated to other nodes in cluster (like change to MyISAM table or some FLUSH command) and then switch over to other node as master. Have fun with starting slave...

Suggested fix:
I think with group replication and multiple-source replication more widely used we may end up with a similar case much more often - some transactions originating on one of numerous GTID-based "masters" are to be skipped on some slaves. The feature I suggest would help to implement this easily as long as GTID-based replication is used.
[13 Jun 2016 13:36] MySQL Verification Team
Hello Valeriy,

Thank you for report and feature request!

Thanks,
Umesh