1include/rpl_init.inc [topology=1->2]
2*** Test connecting with empty GTID state to start from very beginning of binlog ***
3connection server_2;
4include/stop_slave.inc
5RESET MASTER;
6RESET SLAVE;
7connection server_1;
8RESET MASTER;
9FLUSH LOGS;
10CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
11connection server_2;
12SET GLOBAL gtid_slave_pos="";
13CHANGE MASTER TO master_host = '127.0.0.1', master_port = MASTER_PORT,
14MASTER_USE_GTID=CURRENT_POS;
15include/start_slave.inc
16SELECT * FROM t1;
17a
18connection server_1;
19INSERT INTO t1 VALUES (1);
20connection server_2;
21SELECT * FROM t1;
22a
231
24include/stop_slave.inc
25*** Test that master gives error when slave asks for empty gtid pos and binlog files have been purged. ***
26connection server_1;
27FLUSH LOGS;
28INSERT INTO t1 VALUES (2);
29include/wait_for_purge.inc "master-bin.000003"
30show binary logs;
31Log_name	File_size
32master-bin.000003	#
33connection server_2;
34SET GLOBAL gtid_slave_pos="";
35CHANGE MASTER TO master_host = '127.0.0.1', master_port = MASTER_PORT,
36MASTER_USE_GTID=CURRENT_POS;
37START SLAVE;
38include/wait_for_slave_io_error.inc [errno=1236]
39include/stop_slave.inc
40CHANGE MASTER TO master_host = '127.0.0.1', master_port = MASTER_PORT,
41MASTER_LOG_FILE="master-bin.000003", MASTER_LOG_POS=4;
42include/start_slave.inc
43SELECT * FROM t1 ORDER BY a;
44a
451
462
47SET sql_log_bin=0;
48call mtr.add_suppression('Could not find GTID state requested by slave in any binlog files');
49SET sql_log_bin=1;
50*** Test that we give warning when explict @@gtid_slave_pos=xxx that conflicts with what is in our binary log ***
51include/stop_slave.inc
52connection server_1;
53INSERT INTO t1 VALUES(3);
54include/save_master_gtid.inc
55connection server_2;
56SET GLOBAL gtid_slave_pos='0-1-3';
57CHANGE MASTER TO master_host = '127.0.0.1', master_port = MASTER_PORT,
58MASTER_USE_GTID=CURRENT_POS;
59include/start_slave.inc
60include/sync_with_master_gtid.inc
61SELECT * FROM t1 ORDER by a;
62a
631
642
653
66include/stop_slave.inc
67connection server_1;
68INSERT INTO t1 VALUES (4);
69include/save_master_gtid.inc
70connection server_2;
71INSERT INTO t1 VALUES (10);
72DELETE FROM t1 WHERE a=10;
73SET GLOBAL gtid_slave_pos='0-1-4';
74Warnings:
75Warning	1947	Specified GTID 0-1-4 conflicts with the binary log which contains a more recent GTID 0-2-6. If MASTER_GTID_POS=CURRENT_POS is used, the binlog position will override the new value of @@gtid_slave_pos
76RESET MASTER;
77SET GLOBAL gtid_slave_pos='0-1-4';
78START SLAVE;
79include/sync_with_master_gtid.inc
80SELECT * FROM t1 ORDER by a;
81a
821
832
843
854
86connection server_1;
87DROP TABLE t1;
88connection server_2;
89*** MDEV-4275: I/O thread restart duplicates events in relay log ***
90connection server_2;
91include/stop_slave.inc
92RESET SLAVE ALL;
93RESET MASTER;
94connection server_1;
95RESET MASTER;
96connection server_2;
97SET GLOBAL gtid_slave_pos='';
98CHANGE MASTER TO master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root', master_use_gtid=current_pos;
99include/start_slave.inc
100connection server_1;
101CREATE TABLE t1 (a INT PRIMARY KEY);
102INSERT INTO t1 VALUES (1);
103connection server_2;
104SELECT * FROM t1;
105a
1061
107include/stop_slave_io.inc
108START SLAVE IO_THREAD;
109include/wait_for_slave_io_to_start.inc
110connection server_1;
111INSERT INTO t1 VALUES (2);
112connection server_2;
113SELECT * FROM t1 ORDER BY a;
114a
1151
1162
117*** MDEV-4329: GTID_SLAVE_POS='' is not checked for conflicts with binlog ***
118connection server_2;
119include/stop_slave.inc
120DROP TABLE t1;
121RESET SLAVE;
122SET GLOBAL gtid_slave_pos="";
123Warnings:
124Warning	1948	Specified value for @@gtid_slave_pos contains no value for replication domain 0. This conflicts with the binary log which contains GTID 0-2-4. If MASTER_GTID_POS=CURRENT_POS is used, the binlog position will override the new value of @@gtid_slave_pos
125RESET MASTER;
126SET GLOBAL gtid_slave_pos="";
127include/start_slave.inc
128SELECT * FROM t1 ORDER BY a;
129a
1301
1312
132connection server_2;
133include/stop_slave.inc
134SET SQL_LOG_BIN=0;
135DROP TABLE t1;
136SET SQL_LOG_BIN=1;
137RESET SLAVE;
138SET GLOBAL gtid_slave_pos="";
139SET @save_slave_ddl_exec_mode=@@global.slave_ddl_exec_mode;
140SET GLOBAL slave_ddl_exec_mode=STRICT;
141include/start_slave.inc
142SELECT * FROM t1 ORDER BY a;
143a
1441
1452
146*** Test that RESET SLAVE clears the Using_Gtid flag. ***
147include/stop_slave.inc
148RESET SLAVE;
149Using_Gtid = 'No'
150START SLAVE;
151include/wait_for_slave_sql_error.inc [errno=1050]
152STOP SLAVE IO_THREAD;
153CHANGE MASTER TO MASTER_USE_GTID=CURRENT_POS;
154include/start_slave.inc
155connection server_1;
156INSERT INTO t1 VALUES(3);
157include/save_master_gtid.inc
158connection server_2;
159include/sync_with_master_gtid.inc
160SELECT * FROM t1 ORDER BY a;
161a
1621
1632
1643
165SET SQL_LOG_BIN=0;
166call mtr.add_suppression("Slave: Table 't1' already exists error.* 1050");
167SET SQL_LOG_BIN=1;
168*** Test reconnecting slave with GTID after purge logs on master. ***
169connection server_1;
170FLUSH LOGS;
171INSERT INTO t1 VALUES (4);
172include/save_master_gtid.inc
173connection server_2;
174include/sync_with_master_gtid.inc
175include/stop_slave.inc
176connection server_1;
177FLUSH LOGS;
178FLUSH LOGS;
179include/wait_for_purge.inc "master-bin.000004"
180show binary logs;
181Log_name	File_size
182master-bin.000004	#
183INSERT INTO t1 VALUES (5);
184include/save_master_gtid.inc
185connection server_2;
186CHANGE MASTER TO master_host = '127.0.0.1', master_port = MASTER_PORT;
187include/start_slave.inc
188include/sync_with_master_gtid.inc
189SELECT * FROM t1 ORDER BY a;
190a
1911
1922
1933
1944
1955
196*** Test modifying binlog on slave and the effect on GTID state. ***
197connection server_2;
198include/stop_slave.inc
199RESET MASTER;
200SET GLOBAL gtid_slave_pos="";
201connection server_1;
202RESET MASTER;
203TRUNCATE TABLE t1;
204INSERT INTO t1 VALUES (10);
205include/save_master_gtid.inc
206connection server_2;
207include/start_slave.inc
208include/sync_with_master_gtid.inc
209SELECT * FROM t1;
210a
21110
212SELECT 'Current_Pos' AS Using_Gtid;
213Using_Gtid
214Current_Pos
215SELECT '0-1-2' AS Gtid_Slave_Pos;
216Gtid_Slave_Pos
2170-1-2
218UPDATE t1 SET a=9 WHERE a=10;
219UPDATE t1 SET a=10 WHERE a=9;
220SELECT '0-2-4' AS Gtid_Slave_Pos;
221Gtid_Slave_Pos
2220-2-4
223include/stop_slave.inc
224SET GLOBAL gtid_slave_pos='0-1-2';
225Warnings:
226Warning	1947	Specified GTID 0-1-2 conflicts with the binary log which contains a more recent GTID 0-2-4. If MASTER_GTID_POS=CURRENT_POS is used, the binlog position will override the new value of @@gtid_slave_pos
227RESET MASTER;
228SELECT '0-1-2' AS Gtid_Slave_Pos;
229Gtid_Slave_Pos
2300-1-2
231SET GLOBAL gtid_slave_pos='0-1-2';
232include/start_slave.inc
233SELECT '0-1-2' AS Gtid_Slave_Pos;
234Gtid_Slave_Pos
2350-1-2
236*** MDEV-4483: Slave loses traditional master coordinates immediately on CHANGE MASTER TO MASTER_USE_GTID = 1 ***
237connection server_2;
238include/stop_slave.inc
239DROP TABLE t1;
240RESET SLAVE ALL;
241RESET MASTER;
242SET GLOBAL gtid_slave_pos= "";
243CHANGE MASTER TO master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root', master_use_gtid=no, master_log_file="", master_log_pos= 4;
244connection server_1;
245DROP TABLE t1;
246RESET MASTER;
247CREATE TABLE t1 (a INT PRIMARY KEY);
248connection server_2;
249include/start_slave.inc
250include/stop_slave.inc
251connection server_1;
252INSERT INTO t1 VALUES (1);
253INSERT INTO t1 VALUES (2);
254connection server_2;
255START SLAVE UNTIL master_log_file='LOG_FILE1', master_log_pos=LOG_POS1;
256include/wait_for_slave_sql_to_stop.inc
257SELECT * FROM t1;
258a
2591
260include/wait_for_slave_param.inc [Read_Master_Log_Pos]
261include/stop_slave_io.inc
262CHANGE MASTER TO master_use_gtid=slave_pos;
263SET GLOBAL gtid_slave_pos="0-42-42";
264SET sql_log_bin=0;
265call mtr.add_suppression("Error: connecting slave requested to start from GTID");
266SET sql_log_bin=1;
267START SLAVE;
268include/wait_for_slave_io_error.inc [errno=1236]
269STOP SLAVE SQL_THREAD;
270include/wait_for_slave_sql_to_stop.inc
271CHANGE MASTER TO master_use_gtid=no;
272include/start_slave.inc
273SELECT * FROM t1 ORDER BY a;
274a
2751
2762
277connection server_1;
278DROP TABLE t1;
279connection server_2;
280set @@global.slave_ddl_exec_mode=@save_slave_ddl_exec_mode;
281include/rpl_end.inc
282