File: rpl_semi_sync_fail_over.result

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