Debian Codegraph @

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

raw
1 include/master-slave.inc
2 [connection master]
3 connection server_2;
4 include/stop_slave.inc
5 connection server_1;
6 RESET MASTER;
7 SET @@global.max_binlog_size= 4096;
8 set @@global.rpl_semi_sync_master_enabled = 1;
9 connection server_2;
10 RESET MASTER;
11 SET @@global.max_binlog_size= 4096;
12 set @@global.rpl_semi_sync_slave_enabled = 1;
13 set @@global.gtid_slave_pos = "";
14 CHANGE MASTER TO master_use_gtid= slave_pos;
15 include/start_slave.inc
16 connection server_1;
17 ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
18 set @@global.rpl_semi_sync_master_wait_point=AFTER_SYNC;
19 CREATE TABLE t1 (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=Innodb;
20 INSERT INTO t1 VALUES (1, 'dummy1');
21 connection server_2;
22 connection server_1;
23 #
24 # Case:1
25 #
26 # CRASH the original master, and FAILOVER to the new
27 # INSERT INTO t1 VALUES (2, REPEAT("x", 4100))
28 # Row - 2 will be in master's binlog but not committed, gets replicated
29 # to slave and applied. On crash master should have 1 row and slave
30 # should have 2 rows.
31 #
32 # Expected State post crash:
33 #=================================================================
34 # Master | Slave |
35 # 0-1-4 (Not committed) | 0-1-4 (Received through semi-sync |
36 # | replication and applied) |
37 #=================================================================
38 connect conn_client,127.0.0.1,root,,test,$SERVER_MYPORT_1,;
39 SET DEBUG_SYNC= "commit_after_release_LOCK_after_binlog_sync SIGNAL con1_ready WAIT_FOR con1_go";
40 INSERT INTO t1 VALUES (2, REPEAT("x", 4100));
41 connection server_1;
42 SET DEBUG_SYNC= "now WAIT_FOR con1_ready";
43 # Kill the server
44 connection server_2;
45 include/wait_for_slave_param.inc [Slave_SQL_Running_State]
46 include/stop_slave.inc
47 select count(*) 'on slave must be 2' from t1;
48 on slave must be 2
49 2
50 SELECT @@GLOBAL.gtid_current_pos;
51 @@GLOBAL.gtid_current_pos
52 0-1-4
53 # restart: --skip-slave-start=1 --rpl-semi-sync-slave-enabled=1 --init-rpl-role=SLAVE
54 connection server_1;
55 # Ensuring variable rpl_semi_sync_slave_enabled is ON..
56 # Ensuring status rpl_semi_sync_slave_status is OFF..
57 select count(*) 'on master must be 1' from t1;
58 on master must be 1
59 1
60 FOUND 1 /truncated binlog file:.*master.*000001/ in mysqld.1.err
61 disconnect conn_client;
62 connection server_2;
63 set global rpl_semi_sync_master_enabled = 1;
64 set global rpl_semi_sync_master_wait_point=AFTER_SYNC;
65 connection server_1;
66 CHANGE MASTER TO master_host='127.0.0.1', master_port=$new_master_port, master_user='root', master_ssl_verify_server_cert=0, master_use_gtid=SLAVE_POS;
67 set global rpl_semi_sync_slave_enabled = 1;
68 set @@global.gtid_slave_pos=@@global.gtid_binlog_pos;
69 include/start_slave.inc
70 #
71 # Server_2 promoted as master will send 0-1-4 to new slave Server_1
72 #
73 connection server_2;
74 INSERT INTO t1 VALUES (3, 'dummy3');
75 # The gtid state on current master must be equal to ...
76 SHOW VARIABLES LIKE 'gtid_binlog_pos';
77 Variable_name Value
78 gtid_binlog_pos 0-2-5
79 SHOW VARIABLES LIKE 'gtid_binlog_state';
80 Variable_name Value
81 gtid_binlog_state 0-1-4,0-2-5
82 SHOW VARIABLES LIKE 'gtid_slave_pos';
83 Variable_name Value
84 gtid_slave_pos 0-1-4
85 connection server_1;
86 SELECT COUNT(*) 'must be 3' FROM t1;
87 must be 3
88 3
89 # ... the gtid states on the slave:
90 SHOW VARIABLES LIKE 'gtid_slave_pos';
91 Variable_name Value
92 gtid_slave_pos 0-2-5
93 SHOW VARIABLES LIKE 'gtid_binlog_pos';
94 Variable_name Value
95 gtid_binlog_pos 0-2-5
96 SHOW VARIABLES LIKE 'gtid_binlog_state';
97 Variable_name Value
98 gtid_binlog_state 0-1-4,0-2-5
99 connection server_2;
100 #
101 # Case:2
102 #
103 # CRASH the new master, and FAILOVER back to the original
104 # SET STATEMENT server_id=1 FOR INSERT INTO t1 VALUES (4, REPEAT("x", 4100))
105 # INSERT INTO t1 VALUES (5, REPEAT("x", 4100))
106 # Rows 4 and 5 will be in master's binlog but not committed, they get
107 # replicated to slave and applied. On crash master should have 3 rows
108 # and slave should have 5 rows.
109 #
110 # Expected State post crash:
111 #=================================================================
112 # Master | Slave |
113 # 0-1-6 (Not commited) | 0-1-6 (Received through semi-sync |
114 # | replication and applied) |
115 # 0-2-7 (Not commited) | 0-2-7 (Received through semi-sync |
116 # | replication and applied) |
117 #=================================================================
118 connect conn_client,127.0.0.1,root,,test,$SERVER_MYPORT_2,;
119 SET DEBUG_SYNC= "commit_before_get_LOCK_commit_ordered SIGNAL con1_ready WAIT_FOR con1_go";
120 SET DEBUG_SYNC= "commit_after_release_LOCK_after_binlog_sync WAIT_FOR con1_go1";
121 SET STATEMENT server_id=1 FOR INSERT INTO t1 VALUES (4, REPEAT("x", 4100));
122 connect conn_client_2,127.0.0.1,root,,test,$SERVER_MYPORT_2,;
123 SET DEBUG_SYNC= "now WAIT_FOR con1_ready";
124 SET DEBUG_SYNC= "commit_before_get_LOCK_after_binlog_sync SIGNAL con1_go";
125 SET DEBUG_SYNC= "commit_before_get_LOCK_commit_ordered SIGNAL con2_ready";
126 INSERT INTO t1 VALUES (5, REPEAT("x", 4100));
127 connection server_2;
128 SET DEBUG_SYNC= "now WAIT_FOR con2_ready";
129 # Kill the server
130 connection server_1;
131 include/wait_for_slave_param.inc [Slave_SQL_Running_State]
132 include/stop_slave.inc
133 select count(*) 'on slave must be 5' from t1;
134 on slave must be 5
135 5
136 SELECT @@GLOBAL.gtid_current_pos;
137 @@GLOBAL.gtid_current_pos
138 0-2-7
139 # restart: --skip-slave-start=1 --rpl-semi-sync-slave-enabled=1 --init-rpl-role=SLAVE
140 connection server_2;
141 # Ensuring variable rpl_semi_sync_slave_enabled is ON..
142 # Ensuring status rpl_semi_sync_slave_status is OFF..
143 select count(*) 'on master must be 3' from t1;
144 on master must be 3
145 3
146 FOUND 1 /truncated binlog file:.*slave.*000002.* to remove transactions starting from GTID 0-1-6/ in mysqld.2.err
147 disconnect conn_client;
148 connection server_1;
149 set global rpl_semi_sync_master_enabled = 1;
150 set global rpl_semi_sync_master_wait_point=AFTER_SYNC;
151 connection server_2;
152 CHANGE MASTER TO master_host='127.0.0.1', master_port=$new_master_port, master_user='root', master_ssl_verify_server_cert=0, master_use_gtid=SLAVE_POS;
153 set global rpl_semi_sync_slave_enabled = 1;
154 set @@global.gtid_slave_pos=@@global.gtid_binlog_pos;
155 include/start_slave.inc
156 #
157 # Server_1 promoted as master will send 0-1-6 and 0-2-7 to slave Server_2
158 #
159 connection server_1;
160 INSERT INTO t1 VALUES (6, 'dummy6');
161 # The gtid state on current master must be equal to ...
162 SHOW VARIABLES LIKE 'gtid_binlog_pos';
163 Variable_name Value
164 gtid_binlog_pos 0-1-8
165 SHOW VARIABLES LIKE 'gtid_binlog_state';
166 Variable_name Value
167 gtid_binlog_state 0-2-7,0-1-8
168 SHOW VARIABLES LIKE 'gtid_slave_pos';
169 Variable_name Value
170 gtid_slave_pos 0-2-7
171 connection server_2;
172 SELECT COUNT(*) 'must be 6 as' FROM t1;
173 must be 6 as
174 6
175 # ... the gtid states on the slave:
176 SHOW VARIABLES LIKE 'gtid_slave_pos';
177 Variable_name Value
178 gtid_slave_pos 0-1-8
179 SHOW VARIABLES LIKE 'gtid_binlog_pos';
180 Variable_name Value
181 gtid_binlog_pos 0-1-8
182 SHOW VARIABLES LIKE 'gtid_binlog_state';
183 Variable_name Value
184 gtid_binlog_state 0-2-7,0-1-8
185 include/diff_tables.inc [server_1:t1, server_2:t1]
186 connection server_1;
187 #
188 # Case:3
189 #
190 # CRASH the master and FAILOVER to slave
191 # INSERT INTO t1 VALUES (7, REPEAT("x", 4100))
192 # INSERT INTO t1 VALUES (8, REPEAT("x", 4100))
193 # Rows 7 and 8 will be in master's binlog but not committed, only 7
194 # gets replicated to slave and applied. On crash master should have 6
195 # rows and slave should have 7 rows.
196 #
197 # Expected State post crash:
198 #=================================================================
199 # Master | Slave |
200 # 0-1-9 (Not commited) | 0-1-9 (Received through semi-sync |
201 # | replication and applied) |
202 # 0-1-10 (Not commited - | |
203 # never sent to slave) | |
204 #=================================================================
205 connect conn_client,127.0.0.1,root,,test,$SERVER_MYPORT_1,;
206 SET DEBUG_SYNC= "commit_before_get_LOCK_commit_ordered SIGNAL con1_ready WAIT_FOR con1_go";
207 INSERT INTO t1 VALUES (7, REPEAT("x", 4100));
208 connect conn_client_3,127.0.0.1,root,,test,$SERVER_MYPORT_1,;
209 SET DEBUG_SYNC= "now WAIT_FOR con1_ready";
210 SET DEBUG_SYNC= "commit_before_update_binlog_end_pos SIGNAL con3_ready WAIT_FOR con1_go";
211 INSERT INTO t1 VALUES (8, REPEAT("x", 4100));
212 connection server_1;
213 SET DEBUG_SYNC= "now WAIT_FOR con3_ready";
214 # Kill the server
215 connection server_2;
216 include/wait_for_slave_param.inc [Slave_SQL_Running_State]
217 include/stop_slave.inc
218 select count(*) 'on slave must be 7' from t1;
219 on slave must be 7
220 7
221 SELECT @@GLOBAL.gtid_current_pos;
222 @@GLOBAL.gtid_current_pos
223 0-1-9
224 # restart: --skip-slave-start=1 --rpl-semi-sync-slave-enabled=1 --init-rpl-role=SLAVE
225 connection server_1;
226 # Ensuring variable rpl_semi_sync_slave_enabled is ON..
227 # Ensuring status rpl_semi_sync_slave_status is OFF..
228 select count(*) 'on master must be 6' from t1;
229 on master must be 6
230 6
231 FOUND 1 /truncated binlog file:.*master.*000002.* to remove transactions starting from GTID 0-1-9/ in mysqld.1.err
232 disconnect conn_client;
233 connection server_2;
234 set global rpl_semi_sync_master_enabled = 1;
235 set global rpl_semi_sync_master_wait_point=AFTER_SYNC;
236 connection server_1;
237 CHANGE MASTER TO master_host='127.0.0.1', master_port=$new_master_port, master_user='root', master_ssl_verify_server_cert=0, master_use_gtid=SLAVE_POS;
238 set global rpl_semi_sync_slave_enabled = 1;
239 set @@global.gtid_slave_pos=@@global.gtid_binlog_pos;
240 include/start_slave.inc
241 #
242 # Server_2 promoted as master will send 0-1-9 to slave Server_1
243 #
244 connection server_2;
245 INSERT INTO t1 VALUES (8, 'Done');
246 include/save_master_gtid.inc
247 # The gtid state on current master must be equal to ...
248 SHOW VARIABLES LIKE 'gtid_binlog_pos';
249 Variable_name Value
250 gtid_binlog_pos 0-2-10
251 SHOW VARIABLES LIKE 'gtid_binlog_state';
252 Variable_name Value
253 gtid_binlog_state 0-1-9,0-2-10
254 SHOW VARIABLES LIKE 'gtid_slave_pos';
255 Variable_name Value
256 gtid_slave_pos 0-1-9
257 connection server_1;
258 include/sync_with_master_gtid.inc
259 SELECT COUNT(*) 'must be 8' FROM t1;
260 must be 8
261 8
262 # ... the gtid states on the slave:
263 SHOW VARIABLES LIKE 'gtid_slave_pos';
264 Variable_name Value
265 gtid_slave_pos 0-2-10
266 SHOW VARIABLES LIKE 'gtid_binlog_pos';
267 Variable_name Value
268 gtid_binlog_pos 0-2-10
269 SHOW VARIABLES LIKE 'gtid_binlog_state';
270 Variable_name Value
271 gtid_binlog_state 0-1-9,0-2-10
272 #
273 # Cleanup
274 #
275 include/stop_slave.inc
276 set global rpl_semi_sync_slave_enabled = 0;
277 set global rpl_semi_sync_master_enabled = 0;
278 set global rpl_semi_sync_master_wait_point=default;
279 RESET MASTER;
280 RESET SLAVE;
281 connection server_2;
282 RESET MASTER;
283 RESET SLAVE;
284 set @@global.rpl_semi_sync_master_enabled = 0;
285 set @@global.rpl_semi_sync_slave_enabled = 0;
286 set @@global.rpl_semi_sync_master_wait_point=default;
287 CHANGE MASTER TO master_host='127.0.0.1', master_port=$SERVER_MYPORT_1, master_user='root', master_use_gtid=SLAVE_POS;
288 set @@global.gtid_slave_pos=@@global.gtid_binlog_pos;
289 include/start_slave.inc
290 connection server_1;
291 DROP TABLE t1;
292 connection server_2;
293 connection default;
294 include/rpl_end.inc