summaryrefslogtreecommitdiff
path: root/mysql-test/suite/galera_3nodes/t/galera_join_with_cc_C.test
blob: 133903d7cbfa8c34607144f92458c8e73c5fb1e2 (plain)
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
295
296
297
298
299
#
# Tests handling of several configuration changes while a joiner gets
# state transfer
#
# Variant C: sending of state transfer request is scheduled while in non-PRIM
#
# Refs codersihp/galera-bugs#454
#
--source include/have_innodb.inc
--source include/galera_cluster.inc
--source include/galera_have_debug_sync.inc

--let $galera_connection_name = node_3
--let $galera_server_number = 3
--source include/galera_connect.inc

--connection node_1
--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc

CREATE TABLE t1 (pk INT PRIMARY KEY, node INT) ENGINE=innodb;
INSERT INTO t1 VALUES (1, 1);

--connection node_2
--let $wait_condition = SELECT COUNT(*) = 1 FROM t1;
--source include/wait_condition.inc

#
# Isolate node_1 and update cluster state to force node 1 into joiner mode
#
--connection node_1
SET GLOBAL wsrep_provider_options='gmcast.isolate=1';

--connection node_2
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc

--connection node_3
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc

INSERT INTO t1 VALUES (2, 3);

--connection node_2
--let $wait_condition = SELECT COUNT(*) = 2 FROM t1;
--source include/wait_condition.inc

#
# Now reconnect node_1 but first make it block before sending state transfer
# request
#
# THIS IS PC1
#
--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
SET wsrep_sync_wait = 0;
SET wsrep_on = OFF;
--let $galera_sync_point = after_shift_to_joining
--source include/galera_set_sync_point.inc

--connection node_1
SET GLOBAL wsrep_provider_options='gmcast.isolate=0';

--connection node_2
--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc

INSERT INTO t1 VALUES (3, 2);

--connection node_1a
--source include/galera_wait_sync_point.inc
#
# At this point every node thinks that node_1 is in a JOINER state
#

--connection node_3
--let $wait_condition = SELECT COUNT(*) = 3 FROM t1;
--source include/wait_condition.inc

#
# Now that node_1 sent state request and became JOINER isolate node_1 again
# and commit one more action, so that node_1 loses JOINER state
#
--connection node_1
SET GLOBAL wsrep_provider_options='gmcast.isolate=1';

--connection node_2
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc

--connection node_3
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc

INSERT INTO t1 VALUES (4, 3);

--connection node_2
--let $wait_condition = SELECT COUNT(*) = 4 FROM t1;
--source include/wait_condition.inc

#
# Reconnect node_1 again 
#
# THIS IS PC2
#
--connection node_1
SET GLOBAL wsrep_provider_options='gmcast.isolate=0';

--connection node_2
--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc
#
# After this point node_1 is no longer JOINER and is required to start the
# whole procedure over because it missed some actions (4th insert into t1)
#

INSERT INTO t1 VALUES (5, 2);

--connection node_3
--let $wait_condition = SELECT COUNT(*) = 5 FROM t1;
--source include/wait_condition.inc

#
# Now let node_1 continue with IST and finish processing PC1, but make it
# block when processing PC2 right after progressing to JOINER state and
# before IST happens.
#
--connection node_1a
--let $galera_sync_point = before_send_state_request
--source include/galera_set_sync_point.inc
--let $galera_sync_point = after_shift_to_joining
--source include/galera_signal_sync_point.inc
--let $galera_sync_point = before_send_state_request
--source include/galera_wait_sync_point.inc
--source include/galera_clear_sync_point.inc
# Here we are processing PC2 just before sending state request

# since PC1 has been processed node_1 must have 3 rows in t1
# 2 were there before PC1 and one was added while in PC1
--let $wait_condition = SELECT COUNT(*) = 3 FROM t1;
--source include/wait_condition.inc

#
# Now disconnect and reconnect node_1 again to get PC3
# It still is blocked before sending state transfer request in PC2.
#
--connection node_1
SET GLOBAL wsrep_provider_options='gmcast.isolate=1';

--connection node_2
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc

--connection node_3
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc

# Proceed to sending state transfer request
--connection node_1a
--let $galera_sync_point = after_shift_to_joining
--source include/galera_set_sync_point.inc
--let $galera_sync_point = before_send_state_request
--source include/galera_signal_sync_point.inc # before_send_state_request
#
# node_1 proceeds to sending state transfer request, it will be delivered only
# in the next PC which is PC3. Only then the node will shift to JOINING
#
--echo 4
SELECT * FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_debug_sync_waiters';

--connection node_3
INSERT INTO t1 VALUES (6, 3);

--connection node_2
--let $wait_condition = SELECT COUNT(*) = 6 FROM t1;
--source include/wait_condition.inc

--connection node_1
SET GLOBAL wsrep_provider_options='gmcast.isolate=0';

--connection node_2
--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc
#
# This is PC3
#

INSERT INTO t1 VALUES (7, 2);

--connection node_3
--let $wait_condition = SELECT COUNT(*) = 7 FROM t1;
--source include/wait_condition.inc

# node_1 is stiil processing PC2, it was let to send state transfer request
# while in non-PRIM. Now it should be able to complete it and shift to
# JOINING. Make it block on next PC(3) and continue to receive IST
--connection node_1a
--let $galera_sync_point = after_shift_to_joining
--source include/galera_wait_sync_point.inc
--source include/galera_clear_sync_point.inc # won't need it any more
--let $galera_sync_point = process_primary_configuration
--source include/galera_set_sync_point.inc
--let $galera_sync_point = after_shift_to_joining
--source include/galera_signal_sync_point.inc
# continue with IST while still processing PC2

#
# Now disconnect and reconnect node_1 again to generate PC4.
#
--connection node_1
SET GLOBAL wsrep_provider_options='gmcast.isolate=1';

--connection node_2
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc

--connection node_3
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc

INSERT INTO t1 VALUES (8, 3);

--connection node_2
--let $wait_condition = SELECT COUNT(*) = 8 FROM t1;
--source include/wait_condition.inc

--connection node_1
SET GLOBAL wsrep_provider_options='gmcast.isolate=0';

--connection node_2
--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc
#
# This is PC4. node_1 should complete IST, complete PC2, and continue
# with the next item in queue
#
--connection node_1a
--let $galera_sync_point = process_primary_configuration
--source include/galera_wait_sync_point.inc

#
# Now node_1 is blocked before processing PC3, and should have finished state
# transfer started while in PC2.
# State tranfer request was dilivered in PC3 to donor, so node_1 should have
# received IST up to 6 rows in t1 (what was there before PC3).
#
--let $wait_condition = SELECT COUNT(*) = 6 FROM t1;
--source include/wait_condition.inc

--connection node_2
INSERT INTO t1 VALUES (9, 2);

--connection node_3
--let $wait_condition = SELECT COUNT(*) = 9 FROM t1;
--source include/wait_condition.inc

--connection node_1a
# continue with processing PC3
--let $galera_sync_point = process_primary_configuration
--source include/galera_signal_sync_point.inc

# wait for row that follows PC3
--let $wait_condition = SELECT COUNT(*) = 7 FROM t1;
--source include/wait_condition.inc

# wait till PC4
--let $galera_sync_point = process_primary_configuration
--source include/galera_wait_sync_point.inc
#
# Now node_1 is processing PC4, still must have 7 rows in t1
#
--let $wait_condition = SELECT COUNT(*) = 7 FROM t1;
--source include/wait_condition.inc

# Continue with PC4
--let $galera_sync_point = process_primary_configuration
--source include/galera_clear_sync_point.inc
--source include/galera_signal_sync_point.inc
--let $galera_sync_point = after_shift_to_joining
--source include/galera_wait_sync_point.inc
--source include/galera_clear_sync_point.inc
--source include/galera_signal_sync_point.inc

--let $wait_condition = SELECT COUNT(*) = 9 FROM t1;
--source include/wait_condition.inc

--connection node_1
--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
--source include/wait_condition.inc

DROP TABLE t1;

call mtr.add_suppression("WSREP: Send action {\(.*\), STATE_REQUEST} returned -107 \\(Transport endpoint is not connected\\)");
call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required.");

--connection node_2
call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required.");

--connection node_3
call mtr.add_suppression("WSREP: Rejecting JOIN message from \(.*\): new State Transfer required.");