Debian Codegraph @

mysql-test/suite/rpl/r/rpl_gtid_stop_start.result

raw
1 include/rpl_init.inc [topology=1->2]
2 *** Test normal shutdown/restart of slave server configured as a GTID slave. ***
3 connection server_1;
4 CREATE TABLE t1 (a INT PRIMARY KEY);
5 INSERT INTO t1 VALUES (1);
6 connection server_2;
7 include/stop_slave.inc
8 Master_Log_File = 'master-bin.000001'
9 Using_Gtid = 'Slave_Pos'
10 FLUSH LOGS;
11 connection server_1;
12 FLUSH LOGS;
13 include/wait_for_purge.inc "master-bin.000002"
14 show binary logs;
15 Log_name File_size
16 master-bin.000002 #
17 INSERT INTO t1 VALUES (2);
18 FLUSH LOGS;
19 INSERT INTO t1 VALUES (3);
20 include/save_master_gtid.inc
21 show binary logs;
22 Log_name File_size
23 master-bin.000002 #
24 master-bin.000003 #
25 connection server_2;
26 include/sync_with_master_gtid.inc
27 SELECT * FROM t1 ORDER BY a;
28 a
29 1
30 2
31 3
32 *** Test normal shutdown/restart of master server, check binlog state is preserved. ***
33 connection server_1;
34 SET SESSION gtid_domain_id= 1;
35 INSERT INTO t1 VALUES (4);
36 SHOW BINLOG EVENTS IN 'master-bin.000003' LIMIT 1,1;
37 Log_name Pos Event_type Server_id End_log_pos Info
38 master-bin.000003 # Gtid_list # # [0-1-3]
39 FLUSH LOGS;
40 SHOW BINLOG EVENTS IN 'master-bin.000004' LIMIT 1,1;
41 Log_name Pos Event_type Server_id End_log_pos Info
42 master-bin.000004 # Gtid_list # # #
43 connection default;
44 connection server_1;
45 SHOW BINLOG EVENTS IN 'master-bin.000005' LIMIT 1,1;
46 Log_name Pos Event_type Server_id End_log_pos Info
47 master-bin.000005 # Gtid_list # # #
48 show binary logs;
49 Log_name File_size
50 master-bin.000002 #
51 master-bin.000003 #
52 master-bin.000004 #
53 master-bin.000005 #
54 INSERT INTO t1 VALUES(5);
55 include/save_master_gtid.inc
56 connection server_2;
57 include/sync_with_master_gtid.inc
58 FLUSH NO_WRITE_TO_BINLOG TABLES;
59 SELECT * FROM t1 ORDER BY a;
60 a
61 1
62 2
63 3
64 4
65 5
66 *** Test that @@gtid_slave_pos and @@gtid_current_pos are correctly loaded even if slave threads have not started. ***
67 SET @slave_pos2= @@GLOBAL.gtid_slave_pos;
68 SET @current_pos2= @@GLOBAL.gtid_current_pos;
69 SELECT IF(@slave_pos1=@slave_pos2, "OK", CONCAT(@slave_pos1, " != ", @slave_pos2));
70 IF(@slave_pos1=@slave_pos2, "OK", CONCAT(@slave_pos1, " != ", @slave_pos2))
71 OK
72 SELECT IF(@current_pos1=@current_pos2, "OK", CONCAT(@current_pos1, " != ", @current_pos2));
73 IF(@current_pos1=@current_pos2, "OK", CONCAT(@current_pos1, " != ", @current_pos2))
74 OK
75 connection server_1;
76 INSERT INTO t1 VALUES (6);
77 connection server_2;
78 include/start_slave.inc
79 SELECT * FROM t1 ORDER BY a;
80 a
81 1
82 2
83 3
84 4
85 5
86 6
87 *** MDEV-4490: Old-style master position points at the last GTID event after slave restart ***
88 connection server_1;
89 INSERT INTO t1 VALUES (7);
90 connection server_2;
91 FLUSH NO_WRITE_TO_BINLOG TABLES;
92 SELECT * FROM t1 ORDER BY a;
93 a
94 1
95 2
96 3
97 4
98 5
99 6
100 7
101 include/wait_for_slave_to_start.inc
102 connection server_1;
103 connection server_2;
104 SELECT * FROM t1 ORDER BY a;
105 a
106 1
107 2
108 3
109 4
110 5
111 6
112 7
113 *** MDEV-4486: Allow to start old-style replication even if mysql.gtid_slave_pos is unavailable
114 connection server_1;
115 INSERT INTO t1 VALUES (8);
116 DELETE FROM t1 WHERE a=8;
117 connection server_2;
118 connection server_2;
119 include/stop_slave.inc
120 CHANGE MASTER TO master_use_gtid= no;
121 include/start_slave.inc
122 connection server_1;
123 INSERT INTO t1 VALUES (8);
124 connection server_2;
125 FLUSH NO_WRITE_TO_BINLOG TABLES;
126 SELECT * FROM t1 ORDER BY a;
127 a
128 1
129 2
130 3
131 4
132 5
133 6
134 7
135 8
136 include/stop_slave.inc
137 SET sql_log_bin= 0;
138 ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
139 SET sql_log_bin= 1;
140 SELECT * FROM mysql.gtid_slave_pos;
141 ERROR 42000: Unknown storage engine 'InnoDB'
142 SET sql_log_bin=0;
143 call mtr.add_suppression("Failed to load slave replication state from table");
144 call mtr.add_suppression("Unable to load replication GTID slave state");
145 SET sql_log_bin=1;
146 include/start_slave.inc
147 Warnings:
148 Error 1286 Unknown storage engine 'InnoDB'
149 connection server_1;
150 INSERT INTO t1 VALUES (9);
151 connection server_2;
152 FLUSH NO_WRITE_TO_BINLOG TABLES;
153 SELECT * FROM t1 ORDER BY a;
154 a
155 1
156 2
157 3
158 4
159 5
160 6
161 7
162 8
163 9
164 SET sql_log_bin= 0;
165 ALTER TABLE mysql.gtid_slave_pos ENGINE=Aria;
166 SET sql_log_bin= 1;
167 include/start_slave.inc
168 connection server_1;
169 INSERT INTO t1 VALUES (10);
170 connection server_2;
171 include/stop_slave.inc
172 CHANGE MASTER TO master_use_gtid= slave_pos;
173 include/start_slave.inc
174 *** MDEV-4692: mysql.gtid_slave_pos accumulates values for a domain ***
175 SELECT domain_id, COUNT(*) FROM mysql.gtid_slave_pos GROUP BY domain_id;
176 domain_id COUNT(*)
177 0 3
178 1 2
179 connection server_1;
180 INSERT INTO t1 VALUES (11);
181 connection server_2;
182 FLUSH NO_WRITE_TO_BINLOG TABLES;
183 SELECT domain_id, COUNT(*) FROM mysql.gtid_slave_pos GROUP BY domain_id;
184 domain_id COUNT(*)
185 0 4
186 1 2
187 include/start_slave.inc
188 connection server_1;
189 INSERT INTO t1 VALUES (12);
190 INSERT INTO t1 VALUES (13);
191 connection server_2;
192 FLUSH NO_WRITE_TO_BINLOG TABLES;
193 SELECT domain_id, COUNT(*) FROM mysql.gtid_slave_pos GROUP BY domain_id;
194 domain_id COUNT(*)
195 0 3
196 1 1
197 *** MDEV-4650: show variables; ERROR 1946 (HY000): Failed to load replication slave GTID position ***
198 connection server_2;
199 SET sql_log_bin=0;
200 RENAME TABLE mysql.gtid_slave_pos TO mysql.old_gtid_slave_pos;
201 SET sql_log_bin=1;
202 SHOW VARIABLES;
203 SHOW VARIABLES LIKE 'gtid_slave_pos';
204 Variable_name Value
205 gtid_slave_pos
206 SET GLOBAL gtid_slave_pos = '0-1-2';
207 Got one of the listed errors
208 SHOW WARNINGS;
209 Level Code Message
210 Error 1146 Table 'mysql.gtid_slave_pos' doesn't exist
211 Error 1946 Failed to load replication slave GTID position from table mysql.gtid_slave_pos
212 SET sql_log_bin=0;
213 RENAME TABLE mysql.old_gtid_slave_pos TO mysql.gtid_slave_pos;
214 CALL mtr.add_suppression("Failed to load slave replication state from table mysql.gtid_slave_pos");
215 SET sql_log_bin=1;
216 SHOW VARIABLES LIKE 'gtid_slave_pos';
217 Variable_name Value
218 gtid_slave_pos
219 SET GLOBAL gtid_slave_pos = '0-1-2';
220 SHOW VARIABLES LIKE 'gtid_slave_pos';
221 Variable_name Value
222 gtid_slave_pos 0-1-2
223 include/start_slave.inc
224 connection server_1;
225 DROP TABLE t1;
226 include/rpl_end.inc