mariadb/mysql-test/suite/rpl/r/rpl_gtid_mdev4820.result
unknown f0deff867a MDEV-4820: Empty master does not give error for slave GTID position that does not exist in the binlog
The main bug here was the following situation:

Suppose we set up a completely new master2 as an extra multi-master to an
existing slave that already has a different master1 for domain_id=0. When the
slave tries to connect to master2, master2 will not have anything that slave
requests in domain_id=0, but that is fine as master2 is supposedly meant to
serve eg. domain_id=1. (This is MDEV-4485).

But suppose that master2 then actually starts sending events from
domain_id=0. In this case, the fix for MDEV-4485 was incomplete, and the code
would fail to give the error that the position requested by the slave in
domain_id=0 was missing from the binlogs of master2. This could lead to lost
events or completely wrong replication.

The patch for this bug fixes this issue.

In addition, it cleans up the code a bit, getting rid of the fake_gtid_hash in
the code. And the error message when slave and master have diverged due to
alternate future is clarified, as requested in the bug description.
2013-08-16 15:10:25 +02:00

83 lines
2.6 KiB
Text

include/rpl_init.inc [topology=1->2]
include/stop_slave.inc
SET @slave_old_strict= @@GLOBAL.gtid_strict_mode;
SET GLOBAL gtid_strict_mode= 1;
CHANGE MASTER TO master_use_gtid=slave_pos;
include/start_slave.inc
SET @master_old_strict= @@GLOBAL.gtid_strict_mode;
SET GLOBAL gtid_strict_mode= 1;
CREATE TABLE t1 (a INT PRIMARY KEY);
INSERT INTO t1 VALUES (1);
SELECT * FROM t1 ORDER BY a;
a
1
include/stop_slave.inc
INSERT INTO t1 VALUES (2);
INSERT INTO t1 VALUES (3);
RESET MASTER;
SET GLOBAL gtid_slave_pos= 'OLD_GTID_POS';
include/start_slave.inc
INSERT INTO t1 VALUES (4);
SET sql_log_bin= 0;
CALL mtr.add_suppression("The binlog on the master is missing the GTID");
SET sql_log_bin= 1;
include/wait_for_slave_io_error.inc [errno=1236]
STOP SLAVE SQL_THREAD;
SET GLOBAL gtid_slave_pos= 'OLD_GTID_POS';
include/start_slave.inc
SELECT * FROM t1 ORDER BY a;
a
1
4
include/stop_slave.inc
RESET SLAVE ALL;
RESET MASTER;
SET GLOBAL gtid_slave_pos= '0-2-10';
CHANGE MASTER TO master_host = '127.0.0.1', master_port = SERVER_MYPORT_2,
master_user= 'root', master_use_gtid=CURRENT_POS;
START SLAVE;
INSERT INTO t1 VALUES (11);
SET sql_log_bin= 0;
CALL mtr.add_suppression("which is not in the master's binlog. Since the master's binlog contains GTIDs with higher sequence numbers, it probably means that the slave has diverged");
SET sql_log_bin= 1;
include/wait_for_slave_io_error.inc [errno=1236]
STOP SLAVE SQL_THREAD;
SET GLOBAL gtid_slave_pos= '0-2-10';
SET GLOBAL gtid_strict_mode= 0;
include/start_slave.inc
SELECT * FROM t1 ORDER BY a;
a
1
2
3
4
11
include/stop_slave.inc
RESET SLAVE ALL;
INSERT INTO t1 VALUES (12);
INSERT INTO t1 VALUES (22);
CHANGE MASTER TO master_host = '127.0.0.1', master_port = SERVER_MYPORT_1,
master_user= 'root', master_use_gtid=CURRENT_POS;
START SLAVE;
SET sql_log_bin= 0;
CALL mtr.add_suppression("which is not in the master's binlog. Since the master's binlog contains GTIDs with higher sequence numbers, it probably means that the slave has diverged");
SET sql_log_bin= 1;
include/wait_for_slave_io_error.inc [errno=1236]
STOP SLAVE SQL_THREAD;
SET GLOBAL gtid_strict_mode= 0;
CHANGE MASTER TO master_use_gtid=SLAVE_POS;
SET GLOBAL gtid_slave_pos= 'OLD_GTID_POS';
Warnings:
Warning 1947 Specified GTID OLD_GTID_POS conflicts with the binary log which contains a more recent GTID 0-2-12. If MASTER_GTID_POS=CURRENT_POS is used, the binlog position will override the new value of @@gtid_slave_pos.
include/start_slave.inc
SELECT * FROM t1 ORDER BY a;
a
1
4
11
12
22
SET GLOBAL gtid_strict_mode= @slave_old_strict;
DROP TABLE t1;
SET GLOBAL gtid_strict_mode= @master_old_strict;
include/rpl_end.inc