maria-developers team mailing list archive
-
maria-developers team
-
Mailing list archive
-
Message #11383
Updated Gtid_slave_pos of Untracked domain creates skipped events
Hi Andrei, Kristian!
Problem:-
This issue is regarding Mdev-9107 , where we have 3 master master with
do_domain_ids of
replication channel master domain-id . , When one replication channel
is stopped and that master
is updated , slave server updates the gtid slave_pos from second
replication channel. And then
when replication channel is brought up again then since we have
updated the gtid_slave_pos we skip that event.
I have created a abstract test case for this probem.
(3)
^ ^
/ \
(2)----->(1)
3 and 1 is configured with log slave updates.
3 has 2 replication channel m2_s3(do_domain_id=2 ), m1_s3(do_domain_id=1)
1 has one replication channel m2_s1(do_domain_id=2)
I have tried with master_use_gtid == slave_pos and current_pos both
give same result.
When I stop replication channel m2_s3 and then write one-one event in
(2) and (1) server. Server
3 will update its gtid_slave_pos and it will have latest gtid event
seq no from domain id 2 and 1.
When replication channel m2_s3 is bought up again since gtid_slave_pos
of (3) is equal to (2) so
we actually skipped the event generated on server 2.
(I believe network lag between 2-->3 will have similar effect)
(I have attached the test cases)
Possible Solution.
May be we should have one more option in master_use_gtid =
binlog_state ? which will compare its binlog_state to
arriving event gtid no ? (It is different from current_pos ,
current_pos will select the maximum seq_no between binlog_state and
slave_pos)
--
Regards
Sachin Setiya
Software Engineer at MariaDB
diff --git a/mysql-test/suite/multi_source/mdev_9107.cnf b/mysql-test/suite/multi_source/mdev_9107.cnf
new file mode 100644
index 00000000000..f4015b7e2b8
--- /dev/null
+++ b/mysql-test/suite/multi_source/mdev_9107.cnf
@@ -0,0 +1,15 @@
+!include my.cnf
+
+[mysqld.1]
+log-bin
+gtid_domain_id=1
+log-slave-updates
+
+[mysqld.2]
+log-bin
+gtid_domain_id=2
+
+[mysqld.3]
+log-bin
+gtid_domain_id=3
+log-slave-updates
diff --git a/mysql-test/suite/multi_source/mdev_9107.result b/mysql-test/suite/multi_source/mdev_9107.result
new file mode 100644
index 00000000000..c3b0106a0f2
--- /dev/null
+++ b/mysql-test/suite/multi_source/mdev_9107.result
@@ -0,0 +1,112 @@
+#Server 1
+#
+change master 'm2_s1' to master_port=MYPORT_2 , master_host='127.0.0.1', master_user='root', do_domain_ids=(2), master_use_gtid=current_pos;
+start slave "m2_s1";
+set default_master_connection = 'm2_s1';
+include/wait_for_slave_to_start.inc
+#Server 3
+#
+change master 'm2_s3' to master_port=MYPORT_2 , master_host='127.0.0.1', master_user='root', do_domain_ids=(2), master_use_gtid=current_pos;
+change master 'm1_s3' to master_port=MYPORT_1 , master_host='127.0.0.1', master_user='root', do_domain_ids=(1), master_use_gtid=current_pos;
+start all slaves;
+Warnings:
+Note 1937 SLAVE 'm1_s3' started
+Note 1937 SLAVE 'm2_s3' started
+set default_master_connection = 'm2_s3';
+include/wait_for_slave_to_start.inc
+set default_master_connection = 'm1_s3';
+include/wait_for_slave_to_start.inc
+#Server 2
+#
+create database d;
+use d;
+select @@gtid_binlog_state;
+@@gtid_binlog_state
+2-2-1
+select @@gtid_current_pos;
+@@gtid_current_pos
+2-2-1
+select @@gtid_slave_pos;
+@@gtid_slave_pos
+
+#Server 3
+#
+use d;
+select @@gtid_binlog_state;
+@@gtid_binlog_state
+2-2-1
+select @@gtid_current_pos;
+@@gtid_current_pos
+2-2-1
+select @@gtid_slave_pos;
+@@gtid_slave_pos
+2-2-1
+#Server 1
+#
+use d;
+select @@gtid_binlog_state;
+@@gtid_binlog_state
+2-2-1
+select @@gtid_current_pos;
+@@gtid_current_pos
+2-2-1
+select @@gtid_slave_pos;
+@@gtid_slave_pos
+2-2-1
+#Server 3
+#
+stop slave "m2_s3";
+SET default_master_connection = "m2_s3";
+include/wait_for_slave_to_stop.inc
+#Server 2
+#
+create table t1(a int);
+#Server 1
+#
+show tables;
+Tables_in_d
+t1
+create table t2(a int);
+select @@gtid_binlog_state;
+@@gtid_binlog_state
+1-1-1,2-2-2
+select @@gtid_current_pos;
+@@gtid_current_pos
+1-1-1,2-2-2
+select @@gtid_slave_pos;
+@@gtid_slave_pos
+2-2-2
+#Server 3
+#
+show tables;
+Tables_in_d
+t2
+select @@gtid_binlog_state;
+@@gtid_binlog_state
+1-1-1,2-2-1
+select @@gtid_current_pos;
+@@gtid_current_pos
+1-1-1,2-2-2
+select @@gtid_slave_pos;
+@@gtid_slave_pos
+1-1-1,2-2-2
+#Server 3
+#
+start slave "m2_s3";
+SET default_master_connection = "m2_s3";
+include/wait_for_slave_to_start.inc
+show tables;
+Tables_in_d
+t2
+select @@gtid_binlog_state;
+@@gtid_binlog_state
+1-1-1,2-2-1
+select @@gtid_current_pos;
+@@gtid_current_pos
+1-1-1,2-2-2
+select @@gtid_slave_pos;
+@@gtid_slave_pos
+1-1-1,2-2-2
+#Server 2
+#
+drop database d;
diff --git a/mysql-test/suite/multi_source/mdev_9107.test b/mysql-test/suite/multi_source/mdev_9107.test
new file mode 100644
index 00000000000..e059fdff447
--- /dev/null
+++ b/mysql-test/suite/multi_source/mdev_9107.test
@@ -0,0 +1,136 @@
+--source include/not_embedded.inc
+--source include/have_innodb.inc
+--source include/have_debug.inc
+
+
+--connect (server_1,127.0.0.1,root,,,$SERVER_MYPORT_1)
+--connect (server_2,127.0.0.1,root,,,$SERVER_MYPORT_2)
+--connect (server_3,127.0.0.1,root,,,$SERVER_MYPORT_3)
+
+# Replication Topology
+#
+# (3)
+# ^ ^
+# / \
+# / \
+# (2)------>(1)
+#
+# 2->1->3,2->3
+# 3 while connecting to 2 uses do_domain_id=2 and while connecting to 1 uses
+# do domain id 1, 1 while connecting to 2 uses do_domain_id =1
+#
+# We will induce some lag/stop slave between 2 and 3, So that 3 will recieve event from server 1
+# Since do_domain_id is used , so it will not apply the event but it will just update
+# the gtid_slave_pos table.
+# When connection between 2 and 3 is resumed sine gtid_slave_pos has the latest gtid from
+# server 2 its event will not be applied. So this way we will have inconsistency.
+# This setup is abstarct setup more practical setup is in mdev-9107
+
+--connection server_1
+--echo #Server 1
+--echo #
+--replace_result $SERVER_MYPORT_2 MYPORT_2
+eval change master 'm2_s1' to master_port=$SERVER_MYPORT_2 , master_host='127.0.0.1', master_user='root', do_domain_ids=(2), master_use_gtid=current_pos;
+
+start slave "m2_s1";
+set default_master_connection = 'm2_s1';
+--source include/wait_for_slave_to_start.inc
+
+--connection server_3
+--echo #Server 3
+--echo #
+
+--replace_result $SERVER_MYPORT_2 MYPORT_2
+eval change master 'm2_s3' to master_port=$SERVER_MYPORT_2 , master_host='127.0.0.1', master_user='root', do_domain_ids=(2), master_use_gtid=current_pos;
+
+--replace_result $SERVER_MYPORT_1 MYPORT_1
+eval change master 'm1_s3' to master_port=$SERVER_MYPORT_1 , master_host='127.0.0.1', master_user='root', do_domain_ids=(1), master_use_gtid=current_pos;
+
+start all slaves;
+set default_master_connection = 'm2_s3';
+--source include/wait_for_slave_to_start.inc
+set default_master_connection = 'm1_s3';
+--source include/wait_for_slave_to_start.inc
+
+
+--connection server_2
+--echo #Server 2
+--echo #
+create database d;
+use d;
+select @@gtid_binlog_state;
+select @@gtid_current_pos;
+select @@gtid_slave_pos;
+--save_master_pos
+
+--connection server_3
+--echo #Server 3
+--echo #
+--sync_with_master 0,'m2_s3'
+use d;
+select @@gtid_binlog_state;
+select @@gtid_current_pos;
+select @@gtid_slave_pos;
+
+--connection server_1
+--echo #Server 1
+--echo #
+--sync_with_master 0,'m2_s1'
+use d;
+select @@gtid_binlog_state;
+select @@gtid_current_pos;
+select @@gtid_slave_pos;
+
+--connection server_3
+--echo #Server 3
+--echo #
+stop slave "m2_s3";
+SET default_master_connection = "m2_s3";
+--source include/wait_for_slave_to_stop.inc
+
+--connection server_2
+--echo #Server 2
+--echo #
+create table t1(a int);
+--save_master_pos
+
+--connection server_1
+--echo #Server 1
+--echo #
+--sync_with_master 0,'m2_s1'
+show tables;
+#Send event into server 3;
+create table t2(a int);
+--save_master_pos
+select @@gtid_binlog_state;
+select @@gtid_current_pos;
+select @@gtid_slave_pos;
+
+--connection server_3
+--echo #Server 3
+--echo #
+--sleep 2
+#We cant so sync becuase we stopped the slave
+show tables;
+select @@gtid_binlog_state;
+select @@gtid_current_pos;
+select @@gtid_slave_pos;
+
+
+--connection server_3
+--echo #Server 3
+--echo #
+start slave "m2_s3";
+SET default_master_connection = "m2_s3";
+--source include/wait_for_slave_to_start.inc
+--sleep 4
+show tables;
+select @@gtid_binlog_state;
+select @@gtid_current_pos;
+select @@gtid_slave_pos;
+
+# Cleanup
+--connection server_2
+--echo #Server 2
+--echo #
+drop database d;
Follow ups