Bug #91903 replication filter should base on channel scopeinstead of global scope
Submitted: 6 Aug 2018 3:34 Modified: 6 Aug 2018 6:19
Reporter: h h Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Replication Severity:S2 (Serious)
Version:5.7.21 OS:Any
Assigned to: CPU Architecture:Any
Tags: mysql5.7, replication

[6 Aug 2018 3:34] h h
Description:
i have two master A,B and one slave C, and two replication channels ,and set following variables on my.cnf ,but schema aerie on master B, but i find all channels have the filter rule ,but i think the channel filter should base on channel B to C ,not on channel A to C

replicate-wild-do-table      = aerie.ae_goods_product_line_category
replicate-wild-ignore-table      = mysql.%

*************************** 1. row ***************************
               Slave_IO_State: Waiting for master to send event
                  Master_Host: 10.100.3.4
                  Master_User: repl
                  Master_Port: 3307
                Connect_Retry: 60
              Master_Log_File: mysql-bin.000023
          Read_Master_Log_Pos: 682523173
               Relay_Log_File: t-searchmysql-a2-relay-bin-c_all_b.000008
                Relay_Log_Pos: 320
        Relay_Master_Log_File: mysql-bin.000023
             Slave_IO_Running: Yes
            Slave_SQL_Running: Yes
              Replicate_Do_DB:
          Replicate_Ignore_DB:
           Replicate_Do_Table:
       Replicate_Ignore_Table:
      Replicate_Wild_Do_Table: aerie.ae_goods_product_line_category

*************************** 2. row ***************************
               Slave_IO_State: Waiting for master to send event
                  Master_Host: 10.100.1.30
                  Master_User: repl
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: mysql-bin.000002
          Read_Master_Log_Pos: 1754
               Relay_Log_File: t-searchmysql-a2-relay-bin-c_searchmysql_a1.000012
                Relay_Log_Pos: 320
        Relay_Master_Log_File: mysql-bin.000002
             Slave_IO_Running: Yes
            Slave_SQL_Running: Yes
              Replicate_Do_DB:
          Replicate_Ignore_DB:
           Replicate_Do_Table:
       Replicate_Ignore_Table:
      Replicate_Wild_Do_Table: aerie.ae_goods_product_line_category

How to repeat:
set two master and one slave replication ,and write replication filter rules on /etc/my.cnf of slave ,and restart the slave
[6 Aug 2018 6:19] MySQL Verification Team
Hello!

Thank you for the report.
If I understood correctly, you want to have per channel replication filters in multi-source replication environment but this feature is available in >=8.0.1.  Quoting from manual "On a multi-source replication slave, which uses multiple replication channels to process transaction from different sources, use the FOR CHANNEL channel clause to set a replication filter on a replication channel:

CHANGE REPLICATION FILTER REPLICATE_DO_DB = (d1) FOR CHANNEL channel_1;
This enables you to create a channel specific replication filter to filter out selected data from a source. When a FOR CHANNEL clause is provided, the replication filter statement acts on that slave replication channel removing any existing replication filter which has the same filter type as the specified replication filters, and replacing them with the specified filter. Filter types not explicitly listed in the statement are not modified. If issued against a slave replication channel which is not configured, the statement fails with an ER_SLAVE_CONFIGURATION error. If issued against Group Replication channels, the statement fails with an ER_SLAVE_CHANNEL_OPERATION_NOT_ALLOWED error."  - https://dev.mysql.com/doc/refman/8.0/en/change-replication-filter.html

I see you are using 5.7, and in 5.7, we have global replication filters. This allows slave to filter out (or transform) the execution of selected replicated data from all sources when using multi-source replication. - https://mysqlhighavailability.com/the-per-channel-replication-filters/

regards,
Umesh