Debian Codegraph @

mysql-test/suite/rpl_gtid/t/rpl_wait_for_executed_gtid_set.test

raw
1 # ==== Purpose ====
2 #
3 # Test the functionality of WAIT_FOR_EXECUTED_GTID_SET. The following
4 # properties should hold:
5 #
6 # 1. Error conditions:
7 # 1.1. If input is NULL or is a string that does not represent a
8 # valid GTID set, the function returns an error.
9 # 1.2. If the waiting client owns one of the GTIDs, it should
10 # return an error and not wait.
11 # 1.3. If the function is called from a replication thread, it
12 # should return NULL immediately.
13 # 1.4. If GTID_MODE=OFF the function should return an error and not
14 # wait.
15 # See also rpl_set_gtid_mode_ongoing_wait_function.test.
16 # 1.5. If the waiting client session is killed (KILL thread_id), it
17 # should stop immediately.
18 # 1.6. If the waiting client statement is killed (KILL QUERY
19 # thread_id), it should return an error.
20 #
21 # 2. If the GTID set is already part of GTID_EXECUTED, return
22 # immediately. This should hold when waiting for:
23 # 2.1. no GTID (parameter is an empty string)
24 # 2.2. a single GTID
25 # 2.3. multiple GTIDs, all having the same UUID
26 # 2.4. multiple GITDs, all having different UUIDs.
27 # 2.5. multiple GTIDs from a huge set: it should finish fast, not
28 # take time O(size of set)
29 #
30 # 3. If the GTID set is not included in GTID_EXECUTED, it should still
31 # be waiting after 1 second, in case:
32 # 3.1. the timeout is big
33 # 3.2. no timeout is specified.
34 #
35 # 4. If the GTID set is not included in GTID_EXECUTED, but is included
36 # in the union of GTID_EXECUTED and GTID_OWNED, it should wait. If
37 # the owned GTIDs are rolled back, it should still wait. This should
38 # hold in case:
39 # 4.1. the timeout is big
40 # 4.2. no timeout is specified.
41 #
42 # 5. If the GTID set is not included in GTID_EXECUTED, and an
43 # anonymous transaction is committed, the function should still be
44 # waiting. This should hold in case:
45 # 5.1. the timeout is big
46 # 5.2. no timeout is specified
47 #
48 # 6. If the GTID set is not included in GTID_EXECUTED, and a timeout
49 # was specified, it should return after the timeout is reached.
50 #
51 # 7. If the function is waiting for GTIDs, and other threads commit
52 # GTIDs:
53 # 7a. the function should not return before all GTIDs have
54 # committed;
55 # 7b. it should return after all GTIDs have committed.
56 # The following cases are tested:
57 # 7.1. The function waits for one GTID.
58 # 7.2. The function waits for multiple GTIDs having the same
59 # UUID.
60 # 7.3. The function waits for multiple GTIDs having different
61 # UUIDs.
62 # 7.4. The function waits for multiple GTIDs having the same UUID,
63 # some of which have already been committed before the
64 # function starts.
65 # 7.5. The function waits for multiple GTIDs having different
66 # UUIDs, where all the GTIDs for one of the UUIDs are already
67 # committed before the function starts.
68 # 7.6. The function waits for a UUID which does not already exist
69 # in global_sid_map.
70 # This should all work in case the GTIDs are committed:
71 # 7A. from a client on the same server using GTID_NEXT=AUTOMATIC
72 # 7B. from a client on the same server using GTID_NEXT=UUID:NUMBER
73 # 7C. from a slave thread, with slave binary log enabled
74 # 7D. from a slave thread, with slave binary log disabled
75 #
76 # 8. If the function is waiting for multiple GTIDs and those GTIDs are
77 # provided by SET GTID_PURGED, the function should return.
78 # 8.1. If the set provided by SET GTID_PURGED is huge, the
79 # function should return quickly; it should not take time
80 # O(number of GTIDs).
81 #
82 # 9. RESET MASTER should not confuse the function. That is, suppose
83 # the following happens:
84 # 9a. The function waits for multiple GTIDs.
85 # 9b. Some but not all GTIDs are committed.
86 # 9c. RESET MASTER is issued.
87 # 9d. The remaining GTIDs are committed
88 # At this point, despite all GTIDs were committed at some point,
89 # the function should not return, since not all GTIDs are included
90 # in GTID_EXECUTED.
91 # 9e. The first GTIDs are committed again
92 # At this point, the function should finally return.
93 #
94 # All this should hold in the following cases:
95 # I. The slave binary log is enabled.
96 # II. The slave binary log is disabled.
97 #
98 # ==== References ====
99 #
100 # WL#7796: WAIT_FOR_EXECUTED_GTID_SET
101 # - First version of this test, introduced the function.
102 # BUG#19579811: SET GTID_PURGED DOES NOT STOP WAIT_FOR_EXECUTED_GTID_SET
103 # - Rewrote the test, improving general coverage and adding the bug cases.
104
105 # Test requires binlog_format=statement to replicate nondeterministic function
106 --source include/have_binlog_format_statement.inc
107 # Disable auto_position protocol. This is needed since we switch to
108 # gtid_mode=off temporarily.
109 --let $use_gtids= 0
110 --let $rpl_gtid_utils= 1
111 --let $rpl_topology= 1->2, 1->3
112 --source include/rpl_init.inc
113 --source include/rpl_group_replication_plugin_installed.inc
114 --source include/rpl_default_connections.inc
115
116 --echo ==== 0. Initialize ====
117
118 --let $server_number= 1
119 while ($server_number <= 3)
120 {
121 --let $rpl_connection_name= server_$server_number
122 --source include/rpl_connection.inc
123 eval SET GLOBAL GTID_PURGED = '$uuida:1-3,$uuidb:1-3,$uuidf:1-1234567890';
124 --inc $server_number
125 }
126
127 # server_3 uses skip-log-bin. If mtr is invoked with
128 # --mysqld=--binlog-format=X, it gives the following warning.
129 # The following statement uses connection server_3 (set in the loop above).
130 CALL mtr.add_suppression('You need to use --log-bin to make --binlog-format work.');
131 CALL mtr.add_suppression('You need to use --log-bin to make --log-replica-updates work.');
132
133 --source include/rpl_connection_master.inc
134 CALL mtr.add_suppression('Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the replica.');
135 --source include/rpl_sync.inc
136
137 # Group replication commits two extra transactions. To make the test
138 # behave the same way for group replication and async replication, we
139 # commit these two dummy transactions if group replication is not
140 # enabled.
141 if (!$group_replication_plugin_installed)
142 {
143 --disable_query_log
144 CREATE TABLE dummy(a INT);
145 DROP TABLE dummy;
146 --enable_query_log
147 --source include/rpl_sync.inc
148 }
149
150 CREATE TABLE t1 (a INT);
151
152 # At this point the following GTIDs are committed:
153 # $uuida:1-3, $uuidb:1-3, $uuidf:1-1234567890, $server_1_uuid:1-3
154
155 --echo ==== 1. Error conditions ====
156
157 --echo ---- 1.1. NULL or invalid string ----
158
159 # NULL
160 --error ER_MALFORMED_GTID_SET_SPECIFICATION
161 SELECT WAIT_FOR_EXECUTED_GTID_SET(NULL, 5);
162 --error ER_MALFORMED_GTID_SET_SPECIFICATION
163 SELECT WAIT_FOR_EXECUTED_GTID_SET(NULL, NULL);
164 --error ER_MALFORMED_GTID_SET_SPECIFICATION
165 SELECT WAIT_FOR_EXECUTED_GTID_SET(NULL);
166
167 set @null = NULL;
168 --error ER_MALFORMED_GTID_SET_SPECIFICATION
169 SELECT WAIT_FOR_EXECUTED_GTID_SET(@null, @null);
170
171 --error ER_WRONG_ARGUMENTS
172 SELECT WAIT_FOR_EXECUTED_GTID_SET(5, NULL);
173
174 # Invalid GTID set
175 --error ER_MALFORMED_GTID_SET_SPECIFICATION
176 SELECT WAIT_FOR_EXECUTED_GTID_SET('Incorrect_value');
177
178 --error ER_MALFORMED_GTID_SET_SPECIFICATION
179 SELECT WAIT_FOR_EXECUTED_GTID_SET('Incorrect_value', 5);
180
181 # Wrong parameter count
182 --error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
183 SELECT WAIT_FOR_EXECUTED_GTID_SET();
184
185 --error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
186 SELECT WAIT_FOR_EXECUTED_GTID_SET('NULL', 5, 5);
187
188 --echo ---- 1.2. Wait for GTID owned by the waiting client ----
189
190 eval SET @@SESSION.GTID_NEXT = '$uuidc:1';
191
192 # OK to wait for any other GTID. In this case it has already been committed.
193 eval SELECT WAIT_FOR_EXECUTED_GTID_SET('$uuidb:1');
194
195 # Error waiting for owned GTID.
196 --error ER_CANT_WAIT_FOR_EXECUTED_GTID_SET_WHILE_OWNING_A_GTID
197 eval SELECT WAIT_FOR_EXECUTED_GTID_SET('$uuidc:1');
198
199 ROLLBACK;
200
201 # OK to wait for the GTID now that we don't own it.
202 # This should just timeout.
203 eval SELECT WAIT_FOR_EXECUTED_GTID_SET('$uuidc:1', 1);
204
205 SET @@SESSION.GTID_NEXT = 'AUTOMATIC';
206
207 --echo ---- 1.3. Function should return NULL in a replication thread ----
208
209 eval INSERT INTO t1 VALUES (WAIT_FOR_EXECUTED_GTID_SET('$uuida:1'));
210
211 --let $assert_cond= a = 0 FROM t1
212 --let $assert_text= t1 should contain 0
213 --source include/assert.inc
214
215 --source include/sync_slave_sql_with_master.inc
216
217 --let $assert_cond= a IS NULL FROM t1
218 --let $assert_text= t1 should contain NULL
219 --source include/assert.inc
220
221 --source include/rpl_connection_master.inc
222
223 --echo ---- 1.4. Function should generate error if GTID_MODE = OFF ----
224
225 --let $rpl_gtid_mode= off
226 --let $rpl_skip_sync= 1
227 --source include/rpl_set_gtid_mode.inc
228
229 # Wait for GTID that is included in GTID_EXECUTED.
230 --error ER_GTID_MODE_OFF
231 eval SELECT WAIT_FOR_EXECUTED_GTID_SET('$uuida:1');
232
233 # Wait for GTID that is not included in GTID_EXECUTED.
234 --error ER_GTID_MODE_OFF
235 eval SELECT WAIT_FOR_EXECUTED_GTID_SET('$uuida:9999');
236
237 --let $rpl_gtid_mode= on
238 --source include/rpl_set_gtid_mode.inc
239
240 --echo ---- 1.5. Function should stop fast if client is killed ----
241
242 --let $rpl_connection_name= con1
243 --let $rpl_server_number= 1
244 --source include/rpl_connect.inc
245 --let $rpl_connection_name= con1
246 --source include/rpl_connection.inc
247
248 --let $thread_id= `SELECT CONNECTION_ID()`
249
250 --send
251 eval SELECT WAIT_FOR_EXECUTED_GTID_SET('$uuida:9999');
252 --sleep 1
253
254 --source include/rpl_connection_master.inc
255
256 --source include/wait_for_wait_for_executed_gtid_set.inc
257
258 # Kill thread
259 --replace_result $thread_id <THREAD_ID>
260 eval KILL $thread_id;
261
262 # Wait for thread to disappear (if this would not happen fast, the test
263 # would time out).
264 --let $wait_condition= SELECT COUNT(*) = 0 FROM performance_schema.threads WHERE PROCESSLIST_ID = $thread_id
265 --source include/wait_condition.inc
266
267 # Reap
268 --let $rpl_connection_name= con1
269 --source include/rpl_connection.inc
270 # CR_SERVER_LOST
271 --error 2013
272 --reap
273
274 --source include/rpl_connection_master.inc
275
276 --echo ---- 1.6. Function should return error if query is killed ----
277
278 --source include/rpl_connection_master1.inc
279 --let $thread_id= `SELECT CONNECTION_ID()`
280 --send
281 eval SELECT WAIT_FOR_EXECUTED_GTID_SET('$uuida:9999');
282 --source include/rpl_connection_master.inc
283
284 --source include/wait_for_wait_for_executed_gtid_set.inc
285 --let $rpl_connection_name= master1
286 --source include/kill_wait_for_executed_gtid_set.inc
287
288 --source include/rpl_connection_master.inc
289
290 --echo ==== 2. Wait set is already part of GTID_EXECUTED ====
291
292 --echo ---- 2.1. No GTID ----
293
294 SELECT WAIT_FOR_EXECUTED_GTID_SET('');
295 SELECT WAIT_FOR_EXECUTED_GTID_SET('', 999999);
296
297 --echo ---- 2.2. Single GTID ----
298
299 eval SELECT WAIT_FOR_EXECUTED_GTID_SET('$uuida:1');
300 eval SELECT WAIT_FOR_EXECUTED_GTID_SET('$uuida:1', 999999);
301
302 --echo ---- 2.3. Multiple GTIDs, all having the same UUID ----
303
304 eval SELECT WAIT_FOR_EXECUTED_GTID_SET('$uuida:1-3');
305 eval SELECT WAIT_FOR_EXECUTED_GTID_SET('$uuida:1-3', 999999);
306
307 --echo ---- 2.4. Multiple GTIDs using different UUIDs ----
308
309 eval SELECT WAIT_FOR_EXECUTED_GTID_SET('$uuida:1-3,$uuidb:1-3');
310 eval SELECT WAIT_FOR_EXECUTED_GTID_SET('$uuida:1-3,$uuidb:1-3', 999999);
311
312 --echo ---- 2.5. Huge GTID set ----
313
314 eval SELECT WAIT_FOR_EXECUTED_GTID_SET('$uuidf:1-1234567890');
315 eval SELECT WAIT_FOR_EXECUTED_GTID_SET('$uuidf:1-1234567890', 999999);
316
317 --echo ==== 3. Still waiting after 1 second, if GTIDs not committed ====
318
319 --echo ---- 3.1. Big timeout ----
320
321 --source include/rpl_connection_master1.inc
322 --send
323 eval SELECT WAIT_FOR_EXECUTED_GTID_SET('$uuidc:1', 999999);
324 --source include/rpl_connection_master.inc
325
326 --source include/wait_for_wait_for_executed_gtid_set.inc
327 --sleep 1
328 --let $rpl_connection_name= master1
329 --source include/kill_wait_for_executed_gtid_set.inc
330
331 --echo ---- 3.2. No timeout ----
332
333 --source include/rpl_connection_master1.inc
334 --send
335 eval SELECT WAIT_FOR_EXECUTED_GTID_SET('$uuidc:1');
336 --source include/rpl_connection_master.inc
337
338 --source include/wait_for_wait_for_executed_gtid_set.inc
339 --sleep 1
340 --let $rpl_connection_name= master1
341 --source include/kill_wait_for_executed_gtid_set.inc
342
343 --echo ==== 4. Still waiting after 1 second, even if GTID included in GTID_OWNED ====
344
345 --let $rpl_connection_name= server_1
346 --source include/rpl_connection.inc
347 eval SET GTID_NEXT = '$uuidc:1';
348
349 --echo ---- 4.1. Big timeout ----
350
351 --source include/rpl_connection_master1.inc
352 --send
353 eval SELECT WAIT_FOR_EXECUTED_GTID_SET('$uuidc:1', 999999);
354 --source include/rpl_connection_master.inc
355
356 --source include/wait_for_wait_for_executed_gtid_set.inc
357 --sleep 1
358 --let $rpl_connection_name= master1
359 --source include/kill_wait_for_executed_gtid_set.inc
360
361 --echo ---- 4.2. No timeout ----
362
363 --source include/rpl_connection_master1.inc
364 --send
365 eval SELECT WAIT_FOR_EXECUTED_GTID_SET('$uuidc:1');
366 --source include/rpl_connection_master.inc
367
368 --source include/wait_for_wait_for_executed_gtid_set.inc
369 --sleep 1
370 --let $rpl_connection_name= master1
371 --source include/kill_wait_for_executed_gtid_set.inc
372
373 # Release GTID ownership.
374 --let $rpl_connection_name= server_1
375 --source include/rpl_connection.inc
376 ROLLBACK;
377 eval SET GTID_NEXT = 'AUTOMATIC';
378
379 --echo ==== 5. Still waiting if anonymous transaction committed ====
380
381 --let $rpl_gtid_mode= on_permissive
382 --source include/rpl_set_gtid_mode.inc
383
384 --echo ---- 5.1. Big timeout ----
385
386 --source include/rpl_connection_master1.inc
387 --send
388 eval SELECT WAIT_FOR_EXECUTED_GTID_SET('$uuidc:1', 999999);
389 --source include/rpl_connection_master.inc
390
391 --source include/wait_for_wait_for_executed_gtid_set.inc
392 SET GTID_NEXT = 'ANONYMOUS';
393 INSERT INTO t1 VALUES (1);
394 SET GTID_NEXT = 'AUTOMATIC';
395 --sleep 1
396 --let $rpl_connection_name= master1
397 --source include/kill_wait_for_executed_gtid_set.inc
398
399 --echo ---- 5.2. No timeout ----
400
401 --source include/rpl_connection_master1.inc
402 --send
403 eval SELECT WAIT_FOR_EXECUTED_GTID_SET('$uuidc:1');
404 --source include/rpl_connection_master.inc
405
406 --source include/wait_for_wait_for_executed_gtid_set.inc
407 SET GTID_NEXT = 'ANONYMOUS';
408 INSERT INTO t1 VALUES (1);
409 SET GTID_NEXT = 'AUTOMATIC';
410 --sleep 1
411 --let $rpl_connection_name= master1
412 --source include/kill_wait_for_executed_gtid_set.inc
413
414 --let $rpl_gtid_mode= on
415 --source include/rpl_set_gtid_mode.inc
416
417 --echo ==== 6. Stop after the timeout is reached ====
418
419 eval SELECT WAIT_FOR_EXECUTED_GTID_SET('$uuidc:1', 1);
420
421 --let $rpl_connection_name= server_1
422 --source include/rpl_connection.inc
423 eval SET GTID_NEXT = '$uuidc:1';
424 --source include/rpl_connection_master.inc
425
426 eval SELECT WAIT_FOR_EXECUTED_GTID_SET('$uuidc:1', 1);
427
428 --let $rpl_connection_name= server_1
429 --source include/rpl_connection.inc
430 ROLLBACK;
431 SET GTID_NEXT = 'AUTOMATIC';
432 --source include/rpl_connection_master.inc
433
434 --echo ==== 7. ====
435
436 --let $it= 1
437 while ($it <= 4)
438 {
439 if ($it == 1)
440 {
441 --let $wait_connection= server_1
442 --let $wait_for_wait_connection= server_1_1
443 --let $uuid_1= $server_1_uuid
444 --let $uuid_2= $uuidd
445 }
446 if ($it == 2)
447 {
448 --let $wait_connection= server_1
449 --let $wait_for_wait_connection= server_1_1
450 --let $uuid_1= $uuidc
451 --let $uuid_2= $uuidd
452 }
453 if ($it == 3)
454 {
455 --let $wait_connection= server_2
456 --let $wait_for_wait_connection= server_2_1
457 --let $uuid_1= $uuidc
458 --let $uuid_2= $uuidd
459 }
460 if ($it == 4)
461 {
462 --let $wait_connection= server_3
463 --let $wait_for_wait_connection= server_3_1
464 --let $uuid_1= $uuidc
465 --let $uuid_2= $uuidd
466 }
467
468 --echo ---- 7.1 ($it) ----
469
470 --let $gtid= `SELECT GTID_NEXT_GENERATED_MULTIPLE(@@GLOBAL.GTID_EXECUTED, '$uuid_1', 1)`
471 --let $rpl_connection_name= $wait_connection
472 --source include/rpl_connection.inc
473 --let $thread_id= `SELECT CONNECTION_ID()`
474 --replace_result $server_1_uuid SERVER_UUID
475 --send
476 eval SELECT WAIT_FOR_EXECUTED_GTID_SET('$gtid');
477
478 --let $rpl_connection_name= $wait_for_wait_connection
479 --source include/rpl_connection.inc
480 --source include/wait_for_wait_for_executed_gtid_set.inc
481
482 --source include/rpl_connection_master.inc
483 --replace_result $server_1_uuid SERVER_UUID
484 eval SET GTID_NEXT = '$gtid';
485 COMMIT;
486 SET GTID_NEXT = 'AUTOMATIC';
487
488 --let $rpl_connection_name= $wait_connection
489 --source include/rpl_connection.inc
490 --replace_result $server_1_uuid SERVER_UUID
491 --reap
492 --source include/rpl_connection_master.inc
493
494 --echo ---- 7.2 ($it) ----
495
496 --let $gtid_1= `SELECT GTID_NEXT_GENERATED_MULTIPLE(@@GLOBAL.GTID_EXECUTED, '$uuid_1', 1)`
497 --let $gtid_2= `SELECT GTID_NEXT_GENERATED_MULTIPLE(CONCAT(@@GLOBAL.GTID_EXECUTED, ',', '$gtid_1'), '$uuid_1', 1)`
498 --let $rpl_connection_name= $wait_connection
499 --source include/rpl_connection.inc
500 --replace_result $server_1_uuid SERVER_UUID
501 --send
502 eval SELECT WAIT_FOR_EXECUTED_GTID_SET('$gtid_1,$gtid_2');
503
504 --let $rpl_connection_name= $wait_for_wait_connection
505 --source include/rpl_connection.inc
506 --source include/wait_for_wait_for_executed_gtid_set.inc
507
508 --source include/rpl_connection_master.inc
509 --replace_result $server_1_uuid SERVER_UUID
510 eval SET GTID_NEXT = '$gtid_1';
511 COMMIT;
512 SET GTID_NEXT = 'AUTOMATIC';
513
514 # Should still be waiting.
515 --sleep 1
516 --let $rpl_connection_name= $wait_for_wait_connection
517 --source include/rpl_connection.inc
518 --source include/wait_for_wait_for_executed_gtid_set.inc
519
520 --source include/rpl_connection_master.inc
521 --replace_result $server_1_uuid SERVER_UUID
522 eval SET GTID_NEXT = '$gtid_2';
523 COMMIT;
524 SET GTID_NEXT = 'AUTOMATIC';
525
526 --let $rpl_connection_name= $wait_connection
527 --source include/rpl_connection.inc
528 --replace_result $server_1_uuid SERVER_UUID
529 --reap
530 --source include/rpl_connection_master.inc
531
532 --echo ---- 7.3 ($it) ----
533
534 --let $gtid_1= `SELECT GTID_NEXT_GENERATED_MULTIPLE(@@GLOBAL.GTID_EXECUTED, '$uuid_1', 1)`
535 --let $gtid_2= `SELECT GTID_NEXT_GENERATED_MULTIPLE(@@GLOBAL.GTID_EXECUTED, '$uuid_2', 1)`
536 --let $rpl_connection_name= $wait_connection
537 --source include/rpl_connection.inc
538 --replace_result $server_1_uuid SERVER_UUID
539 --send
540 eval SELECT WAIT_FOR_EXECUTED_GTID_SET('$gtid_1,$gtid_2');
541
542 --let $rpl_connection_name= $wait_for_wait_connection
543 --source include/rpl_connection.inc
544 --source include/wait_for_wait_for_executed_gtid_set.inc
545
546 --source include/rpl_connection_master.inc
547 --replace_result $server_1_uuid SERVER_UUID
548 eval SET GTID_NEXT = '$gtid_1';
549 COMMIT;
550 SET GTID_NEXT = 'AUTOMATIC';
551
552 # Should still be waiting.
553 --sleep 1
554 --let $rpl_connection_name= $wait_for_wait_connection
555 --source include/rpl_connection.inc
556 --source include/wait_for_wait_for_executed_gtid_set.inc
557
558 --source include/rpl_connection_master.inc
559 --replace_result $server_1_uuid SERVER_UUID
560 eval SET GTID_NEXT = '$gtid_2';
561 COMMIT;
562 SET GTID_NEXT = 'AUTOMATIC';
563
564 --let $rpl_connection_name= $wait_connection
565 --source include/rpl_connection.inc
566 --replace_result $server_1_uuid SERVER_UUID
567 --reap
568 --source include/rpl_connection_master.inc
569
570 --echo ---- 7.4 ($it) ----
571
572 --let $gtid_1= `SELECT GTID_NEXT_GENERATED_MULTIPLE(@@GLOBAL.GTID_EXECUTED, '$uuid_1', 1)`
573 --let $gtid_2= `SELECT GTID_NEXT_GENERATED_MULTIPLE(@@GLOBAL.GTID_EXECUTED, '$uuid_2', 1)`
574
575 --let $rpl_connection_name= $wait_connection
576 --source include/rpl_connection.inc
577 --replace_result $server_1_uuid SERVER_UUID
578 --send
579 eval SELECT WAIT_FOR_EXECUTED_GTID_SET('$uuid_1:1,$gtid_1,$gtid_2');
580
581 --let $rpl_connection_name= $wait_for_wait_connection
582 --source include/rpl_connection.inc
583 --source include/wait_for_wait_for_executed_gtid_set.inc
584
585 --source include/rpl_connection_master.inc
586 --replace_result $server_1_uuid SERVER_UUID
587 eval SET GTID_NEXT = '$gtid_1';
588 COMMIT;
589 SET GTID_NEXT = 'AUTOMATIC';
590
591 # Should still be waiting.
592 --sleep 1
593 --let $rpl_connection_name= $wait_for_wait_connection
594 --source include/rpl_connection.inc
595 --source include/wait_for_wait_for_executed_gtid_set.inc
596
597 --source include/rpl_connection_master.inc
598 --replace_result $server_1_uuid SERVER_UUID
599 eval SET GTID_NEXT = '$gtid_2';
600 COMMIT;
601 SET GTID_NEXT = 'AUTOMATIC';
602
603 --let $rpl_connection_name= $wait_connection
604 --source include/rpl_connection.inc
605 --replace_result $server_1_uuid SERVER_UUID
606 --reap
607 --source include/rpl_connection_master.inc
608
609 --echo ---- 7.5 ($it) ----
610
611 --let $gtid_1= `SELECT GTID_NEXT_GENERATED_MULTIPLE(@@GLOBAL.GTID_EXECUTED, '$uuid_1', 1)`
612 --let $rpl_connection_name= $wait_connection
613 --source include/rpl_connection.inc
614 --replace_result $server_1_uuid SERVER_UUID
615 --send
616 eval SELECT WAIT_FOR_EXECUTED_GTID_SET('$gtid_1,$uuidb:1-3');
617
618 --let $rpl_connection_name= $wait_for_wait_connection
619 --source include/rpl_connection.inc
620 --source include/wait_for_wait_for_executed_gtid_set.inc
621
622 --source include/rpl_connection_master.inc
623 --replace_result $server_1_uuid SERVER_UUID
624 eval SET GTID_NEXT = '$gtid_1';
625 COMMIT;
626 SET GTID_NEXT = 'AUTOMATIC';
627
628 --let $rpl_connection_name= $wait_connection
629 --source include/rpl_connection.inc
630 --replace_result $server_1_uuid SERVER_UUID
631 --reap
632 --source include/rpl_connection_master.inc
633
634 --echo ---- 7.6 ($it) ----
635
636 if ($it != 1)
637 {
638 --let $uuid= `SELECT UUID()`
639
640 --let $rpl_connection_name= $wait_connection
641 --source include/rpl_connection.inc
642 --replace_result $uuid UUID
643 --send
644 eval SELECT WAIT_FOR_EXECUTED_GTID_SET('$uuid:1');
645
646 --let $rpl_connection_name= $wait_for_wait_connection
647 --source include/rpl_connection.inc
648 --source include/wait_for_wait_for_executed_gtid_set.inc
649
650 --source include/rpl_connection_master.inc
651 --replace_result $uuid UUID
652 eval SET GTID_NEXT = '$uuid:1';
653 COMMIT;
654 SET GTID_NEXT = 'AUTOMATIC';
655
656 --let $rpl_connection_name= $wait_connection
657 --source include/rpl_connection.inc
658 --replace_result $uuid UUID
659 --reap
660 --source include/rpl_connection_master.inc
661 }
662
663 --inc $it
664 }
665
666 --echo ==== 8.1 SET GTID_PURGED ====
667
668 DROP TABLE t1;
669 --source include/rpl_sync.inc
670 --source include/rpl_stop_slaves.inc
671 RESET MASTER;
672
673 --source include/rpl_connection_master1.inc
674 --let $thread_id= `SELECT CONNECTION_ID()`
675 --send
676 eval SELECT WAIT_FOR_EXECUTED_GTID_SET('$uuida:1-1234567890');
677
678 --source include/rpl_connection_master.inc
679 --source include/wait_for_wait_for_executed_gtid_set.inc
680
681 eval SET GLOBAL GTID_PURGED = '$uuida:1-1234567890';
682
683 --source include/rpl_connection_master1.inc
684 --reap
685
686 --source include/rpl_connection_master.inc
687
688 --echo ==== 9. RESET MASTER ====
689
690 RESET MASTER;
691
692 --source include/rpl_connection_master1.inc
693 --send
694 eval SELECT WAIT_FOR_EXECUTED_GTID_SET('$uuida:1,$uuidb:1,$uuidc:1');
695
696 --source include/rpl_connection_master.inc
697 --source include/wait_for_wait_for_executed_gtid_set.inc
698
699 eval SET GLOBAL GTID_PURGED = '$uuida:1';
700
701 eval SET GTID_NEXT = '$uuidb:1';
702 COMMIT;
703 SET GTID_NEXT = 'AUTOMATIC';
704
705 RESET MASTER;
706
707 eval SET SESSION GTID_NEXT = '$uuidc:1';
708 COMMIT;
709 SET GTID_NEXT = 'AUTOMATIC';
710
711 eval SET SESSION GTID_NEXT = '$uuida:1';
712 COMMIT;
713 SET GTID_NEXT = 'AUTOMATIC';
714
715 --sleep 1
716
717 # Should still be waiting
718 --source include/wait_for_wait_for_executed_gtid_set.inc
719
720 eval SET SESSION GTID_NEXT = '$uuidb:1';
721 COMMIT;
722 SET GTID_NEXT = 'AUTOMATIC';
723
724 --source include/rpl_connection_master1.inc
725 --reap
726
727 --source include/rpl_connection_master.inc
728
729 --echo ==== 10. Clean up ====
730
731 --let $rpl_only_running_threads= 1
732 --source include/rpl_end.inc