diff --git a/mysql-test/suite/rpl/r/rpl_gtid_mdev9033.result b/mysql-test/suite/rpl/r/rpl_gtid_mdev9033.result new file mode 100644 index 00000000000..fdee91f39ca --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_gtid_mdev9033.result @@ -0,0 +1,73 @@ +include/rpl_init.inc [topology=1->2->3] +include/stop_slave.inc +CHANGE MASTER TO +MASTER_USE_GTID = SLAVE_POS, IGNORE_SERVER_IDS = (2,3); +CHANGE MASTER "M_3" TO +MASTER_HOST = "127.0.0.1", MASTER_PORT = SERVER_MYPORT_3, +MASTER_USER = "root", MASTER_USE_GTID = SLAVE_POS, +IGNORE_SERVER_IDS = (1,2); +START ALL SLAVES; +Warnings: +Note 1937 SLAVE 'M_3' started +Note 1937 SLAVE '' started +include/stop_slave.inc +CHANGE MASTER "M_1" TO +MASTER_HOST = "127.0.0.1", MASTER_PORT = MASTER_MYPORT, +MASTER_USER = "root", MASTER_USE_GTID = SLAVE_POS, +IGNORE_SERVER_IDS = (2,3); +CHANGE MASTER TO +MASTER_USE_GTID = SLAVE_POS, IGNORE_SERVER_IDS = (1,3); +START ALL SLAVES; +Warnings: +Note 1937 SLAVE 'M_1' started +Note 1937 SLAVE '' started +CHANGE MASTER "M_2" TO +MASTER_HOST = "127.0.0.1", MASTER_PORT = SLAVE_MYPORT, +MASTER_USER = "root", MASTER_USE_GTID = SLAVE_POS, +IGNORE_SERVER_IDS = (1,3); +CHANGE MASTER "M_3" TO +MASTER_HOST = "127.0.0.1", MASTER_PORT = SERVER_MYPORT_3, +MASTER_USER = "root", MASTER_USE_GTID = SLAVE_POS, +IGNORE_SERVER_IDS = (1,2); +START ALL SLAVES; +Warnings: +Note 1937 SLAVE 'M_3' started +Note 1937 SLAVE 'M_2' started +CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(10)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1, "m1"); +INSERT INTO t1 VALUES (2, "m2"), (3, "m3"), (4, "m4"); +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +SELECT * FROM t1 ORDER BY a; +a b +1 m1 +2 m2 +3 m3 +4 m4 +include/sync_with_master_gtid.inc +SELECT * FROM t1 ORDER BY a; +a b +1 m1 +2 m2 +3 m3 +4 m4 +# Cleanup +DROP TABLE t1; +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +include/sync_with_master_gtid.inc +STOP SLAVE "M_3"; +RESET SLAVE "M_3" ALL; +STOP SLAVE "M_1"; +RESET SLAVE "M_1" ALL; +STOP SLAVE "M_2"; +RESET SLAVE "M_2" ALL; +STOP SLAVE "M_3"; +RESET SLAVE "M_3" ALL; +include/sync_with_master_gtid.inc +STOP SLAVE; +CHANGE MASTER TO MASTER_USE_GTID = NO, IGNORE_SERVER_IDS = (); +include/sync_with_master_gtid.inc +STOP SLAVE; +CHANGE MASTER TO MASTER_USE_GTID = NO, IGNORE_SERVER_IDS = (); +# End of test. diff --git a/mysql-test/suite/rpl/t/rpl_gtid_mdev9033.cnf b/mysql-test/suite/rpl/t/rpl_gtid_mdev9033.cnf new file mode 100644 index 00000000000..80b66498022 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_gtid_mdev9033.cnf @@ -0,0 +1,20 @@ +!include ../my.cnf + +[mysqld.1] +log-slave-updates +loose-innodb +gtid_domain_id=1 + +[mysqld.2] +log-slave-updates +loose-innodb +gtid_domain_id=2 + +[mysqld.3] +log-slave-updates +loose-innodb +gtid_domain_id=3 + +[ENV] +SERVER_MYPORT_3= @mysqld.3.port +SERVER_MYSOCK_3= @mysqld.3.socket diff --git a/mysql-test/suite/rpl/t/rpl_gtid_mdev9033.test b/mysql-test/suite/rpl/t/rpl_gtid_mdev9033.test new file mode 100644 index 00000000000..8b51d963bb7 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_gtid_mdev9033.test @@ -0,0 +1,92 @@ +--source include/have_innodb.inc +--let $rpl_topology=1->2->3 +--source include/rpl_init.inc + +--connection server_2 +--source include/stop_slave.inc +eval CHANGE MASTER TO + MASTER_USE_GTID = SLAVE_POS, IGNORE_SERVER_IDS = (2,3); +--replace_result $SERVER_MYPORT_3 SERVER_MYPORT_3 +eval CHANGE MASTER "M_3" TO + MASTER_HOST = "127.0.0.1", MASTER_PORT = $SERVER_MYPORT_3, + MASTER_USER = "root", MASTER_USE_GTID = SLAVE_POS, + IGNORE_SERVER_IDS = (1,2); +START ALL SLAVES; + +--connection server_3 +--source include/stop_slave.inc +--replace_result $MASTER_MYPORT MASTER_MYPORT +eval CHANGE MASTER "M_1" TO + MASTER_HOST = "127.0.0.1", MASTER_PORT = $MASTER_MYPORT, + MASTER_USER = "root", MASTER_USE_GTID = SLAVE_POS, + IGNORE_SERVER_IDS = (2,3); +eval CHANGE MASTER TO + MASTER_USE_GTID = SLAVE_POS, IGNORE_SERVER_IDS = (1,3); +START ALL SLAVES; + +--connection server_1 +--replace_result $SLAVE_MYPORT SLAVE_MYPORT +eval CHANGE MASTER "M_2" TO + MASTER_HOST = "127.0.0.1", MASTER_PORT = $SLAVE_MYPORT, + MASTER_USER = "root", MASTER_USE_GTID = SLAVE_POS, + IGNORE_SERVER_IDS = (1,3); +--replace_result $SERVER_MYPORT_3 SERVER_MYPORT_3 +eval CHANGE MASTER "M_3" TO + MASTER_HOST = "127.0.0.1", MASTER_PORT = $SERVER_MYPORT_3, + MASTER_USER = "root", MASTER_USE_GTID = SLAVE_POS, + IGNORE_SERVER_IDS = (1,2); +START ALL SLAVES; + +connection server_1; + +CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(10)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1, "m1"); +INSERT INTO t1 VALUES (2, "m2"), (3, "m3"), (4, "m4"); + +--source include/save_master_gtid.inc + +connection server_2; +--source include/sync_with_master_gtid.inc +let $wait_condition=SELECT COUNT(*)=4 FROM t1; +--source include/wait_condition.inc +SELECT * FROM t1 ORDER BY a; + +connection server_3; +--source include/sync_with_master_gtid.inc +--source include/wait_condition.inc +SELECT * FROM t1 ORDER BY a; + +--echo # Cleanup +--connection server_1 +DROP TABLE t1; +--source include/save_master_gtid.inc +--connection server_2 +--source include/sync_with_master_gtid.inc +--connection server_3 +--source include/sync_with_master_gtid.inc + +--connection server_2 +STOP SLAVE "M_3"; +RESET SLAVE "M_3" ALL; + +--connection server_3 +STOP SLAVE "M_1"; +RESET SLAVE "M_1" ALL; + +--connection server_1 +STOP SLAVE "M_2"; +RESET SLAVE "M_2" ALL; +STOP SLAVE "M_3"; +RESET SLAVE "M_3" ALL; + +--connection server_2 +--source include/sync_with_master_gtid.inc +STOP SLAVE; +CHANGE MASTER TO MASTER_USE_GTID = NO, IGNORE_SERVER_IDS = (); + +--connection server_3 +--source include/sync_with_master_gtid.inc +STOP SLAVE; +CHANGE MASTER TO MASTER_USE_GTID = NO, IGNORE_SERVER_IDS = (); + +--echo # End of test. diff --git a/sql/slave.cc b/sql/slave.cc index 235b26f81ae..58cb508f8c8 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -5875,22 +5875,6 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len) } };); - if (mi->using_gtid != Master_info::USE_GTID_NO && - mi->domain_id_filter.is_group_filtered() && - mi->events_queued_since_last_gtid > 0 && - ((mi->last_queued_gtid_standalone && - !Log_event::is_part_of_group((Log_event_type)(uchar) - buf[EVENT_TYPE_OFFSET])) || - (!mi->last_queued_gtid_standalone && - ((uchar)buf[EVENT_TYPE_OFFSET] == XID_EVENT || - ((uchar)buf[EVENT_TYPE_OFFSET] == QUERY_EVENT && - Query_log_event::peek_is_commit_rollback(buf, event_len, - checksum_alg)))))) - { - /* Reset the domain_id_filter flag. */ - mi->domain_id_filter.reset_filter(); - } - if (mi->using_gtid != Master_info::USE_GTID_NO && mi->gtid_event_seen) { if (unlikely(mi->gtid_reconnect_event_skip_count)) @@ -6076,6 +6060,9 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len) */ mi->gtid_current_pos.update(&mi->last_queued_gtid); mi->events_queued_since_last_gtid= 0; + + /* Reset the domain_id_filter flag. */ + mi->domain_id_filter.reset_filter(); } skip_relay_logging: