Skip to content

Commit

Permalink
MDEV-9033: Incorrect statements binlogged on slave with do_domain_ids…
Browse files Browse the repository at this point in the history
…=(...)

Post-fix: The test case pushed with the fix had each node
acting as slave to the other two nodes with different set
of filters on server_id's. The slave's gtid_slave_pos is
updated after it processes the events received from master
nodes irrespective of whether the events were filtered
or not. Thus, sync_with_master_gtid.inc could unblock even
on filtered events.
As a result, sync_with_master_gtid.inc would fail to block
until the desired changes have been replicated.  Fixed by
simplifying the topology.
Also, modified CHANGE MASTER commands to ignore based
on gtid_domain_id instead of server_id.
  • Loading branch information
Nirbhay Choubey committed Nov 23, 2015
1 parent edf6354 commit 22b5942
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 89 deletions.
66 changes: 24 additions & 42 deletions mysql-test/suite/rpl/r/rpl_gtid_mdev9033.result
Original file line number Diff line number Diff line change
@@ -1,41 +1,20 @@
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
MASTER_USE_GTID = SLAVE_POS, IGNORE_DOMAIN_IDS = (2,3);
START SLAVE;
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
MASTER_USE_GTID = SLAVE_POS, IGNORE_DOMAIN_IDS = (2,3);
START SLAVE;
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");
SET @@session.gtid_domain_id=2;
# The following should get filetered on slave.
CREATE TABLE t2 (a INT PRIMARY KEY, b VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t2 VALUES (1, "m1");
INSERT INTO t2 VALUES (2, "m2"), (3, "m3"), (4, "m4");
include/save_master_gtid.inc
include/sync_with_master_gtid.inc
SELECT * FROM t1 ORDER BY a;
Expand All @@ -44,30 +23,33 @@ a b
2 m2
3 m3
4 m4
# Only 't1' should have replicated to slaves.
SHOW TABLES;
Tables_in_test
t1
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
# Only 't1' should have replicated to slaves.
SHOW TABLES;
Tables_in_test
t1
# Cleanup
SET @@session.gtid_domain_id=1;
DROP TABLE t1;
SET @@session.gtid_domain_id=2;
DROP TABLE t2;
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/save_master_gtid.inc
include/sync_with_master_gtid.inc
STOP SLAVE;
CHANGE MASTER TO MASTER_USE_GTID = NO, IGNORE_SERVER_IDS = ();
include/sync_with_master_gtid.inc
CHANGE MASTER TO MASTER_USE_GTID = NO, IGNORE_DOMAIN_IDS = ();
STOP SLAVE;
CHANGE MASTER TO MASTER_USE_GTID = NO, IGNORE_SERVER_IDS = ();
CHANGE MASTER TO MASTER_USE_GTID = NO, IGNORE_DOMAIN_IDS = ();
# End of test.
74 changes: 27 additions & 47 deletions mysql-test/suite/rpl/t/rpl_gtid_mdev9033.test
Original file line number Diff line number Diff line change
Expand Up @@ -5,88 +5,68 @@
--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;
MASTER_USE_GTID = SLAVE_POS, IGNORE_DOMAIN_IDS = (2,3);
START SLAVE;

--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;
MASTER_USE_GTID = SLAVE_POS, IGNORE_DOMAIN_IDS = (2,3);
START SLAVE;

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

SET @@session.gtid_domain_id=2;
--echo # The following should get filetered on slave.
CREATE TABLE t2 (a INT PRIMARY KEY, b VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t2 VALUES (1, "m1");
INSERT INTO t2 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;
--echo # Only 't1' should have replicated to slaves.
SHOW TABLES;

--source include/save_master_gtid.inc

connection server_3;
--source include/sync_with_master_gtid.inc
--source include/wait_condition.inc

SELECT * FROM t1 ORDER BY a;
--echo # Only 't1' should have replicated to slaves.
SHOW TABLES;

--echo # Cleanup
--connection server_1
SET @@session.gtid_domain_id=1;
DROP TABLE t1;
SET @@session.gtid_domain_id=2;
DROP TABLE t2;

--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;
--source include/save_master_gtid.inc

--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;
--source include/sync_with_master_gtid.inc

--connection server_2
--source include/sync_with_master_gtid.inc
STOP SLAVE;
CHANGE MASTER TO MASTER_USE_GTID = NO, IGNORE_SERVER_IDS = ();
CHANGE MASTER TO MASTER_USE_GTID = NO, IGNORE_DOMAIN_IDS = ();

--connection server_3
--source include/sync_with_master_gtid.inc
STOP SLAVE;
CHANGE MASTER TO MASTER_USE_GTID = NO, IGNORE_SERVER_IDS = ();
CHANGE MASTER TO MASTER_USE_GTID = NO, IGNORE_DOMAIN_IDS = ();

--echo # End of test.

0 comments on commit 22b5942

Please sign in to comment.