Commit 22b59426 authored by Nirbhay Choubey's avatar Nirbhay Choubey

MDEV-9033: Incorrect statements binlogged on slave with do_domain_ids=(...)

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.
parent edf6354b
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;
......@@ -44,6 +23,11 @@ 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
......@@ -51,23 +35,21 @@ a b
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.
......@@ -5,37 +5,14 @@
--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;
......@@ -43,50 +20,53 @@ 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.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment