Debian Codegraph @

mysql-test/suite/ndb_rpl/r/ndb_rpl_conflict_epoch2_extra.result

raw
1 include/master-slave.inc
2 Warnings:
3 Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
4 Note #### Storing MySQL user name or password information in the connection metadata repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START REPLICA; see the 'START REPLICA Syntax' in the MySQL Manual for more information.
5 [connection master]
6 Setup circular replication
7 The circle is setup between Primary and Secondary
8 Setup ndb_replication and t1 exceptions table
9 Populate ndb_replication table
10 create table test.t1$EX(
11 ndb$server_id int unsigned,
12 ndb$master_server_id int unsigned,
13 ndb$master_epoch bigint unsigned,
14 ndb$count int unsigned,
15 k int not null,
16 v$old int,
17 v$new int,
18 c$old varchar(2000),
19 c$new varchar(2000),
20 ndb$op_type enum('write_row','update_row', 'delete_row') not null,
21 ndb$cft_cause enum('row_does_not_exist','row_already_exists','data_in_conflict','trans_in_conflict') not null,
22 primary key(ndb$server_id, ndb$master_server_id, ndb$master_epoch, ndb$count))
23 engine ndb character set latin1;
24 create table test.t1 (
25 k int primary key,
26 v int,
27 c varchar(2000)) engine=ndb character set latin1;
28 Setup conflict roles
29 --------------------
30 STOP SLAVE;
31 Warnings:
32 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
33 set global ndb_applier_conflict_role="PRIMARY";
34 START SLAVE;
35 Warnings:
36 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
37 STOP SLAVE;
38 Warnings:
39 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
40 set global ndb_applier_conflict_role="SECONDARY";
41 START SLAVE;
42 Warnings:
43 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
44 Create some initial data
45 ------------------------
46 insert into test.t1 values
47 (1,10, "Swimming"),
48 (2,20, "Cycling"),
49 (3,30, "Running"),
50 (4,40, "Triathlon");
51 Content on PRIMARY
52 select * from test.t1 order by k;
53 k v c
54 1 10 Swimming
55 2 20 Cycling
56 3 30 Running
57 4 40 Triathlon
58 Content on SECONDARY
59 select * from test.t1 order by k;
60 k v c
61 1 10 Swimming
62 2 20 Cycling
63 3 30 Running
64 4 40 Triathlon
65 Basic delete-delete cases
66 -------------------------
67 Stop Slave on SECONDARY
68 STOP SLAVE;
69 Warnings:
70 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
71 Delete row 3 on PRIMARY
72 delete from t1 where k=3;
73 Delete row 3 on SECONDARY
74 delete from t1 where k=3;
75 Insert replacement row on SECONDARY
76 This is likely to go in the same SECONDARY epoch transaction
77 insert into t1 values (3,31, "Judo");
78 Wait for SECONDARY change to apply on PRIMARY
79 Expect it to apply correctly here as the PRIMARY
80 has no track of its outstanding DELETE
81
82 PRIMARY content
83 select * from test.t1 order by k;
84 k v c
85 1 10 Swimming
86 2 20 Cycling
87 3 31 Judo
88 4 40 Triathlon
89 PRIMARY counters
90 Conflict algorithm counter diff :
91 ndb_conflict_fn_epoch2
92 1
93 ndb_conflict_fn_epoch2_trans
94 0
95 ndb_conflict_trans_reject_count
96 0
97 ndb_conflict_epoch_delete_delete_count
98 1
99 ndb_conflict_refresh_op_count
100 0
101 reflected_op_prepare_count_greater_than_zero
102 0
103 any_reflected_ops_applied
104 0
105 last_conflict_epoch_increased
106 1
107 conflict_handling_in_progess
108 1
109 stable_epoch_is_older_than_max_replicated
110 0
111 Re-enable SECONDARY Slave, and check state there
112 START SLAVE;
113 Warnings:
114 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
115 SECONDARY content
116 select * from test.t1 order by k;
117 k v c
118 1 10 Swimming
119 2 20 Cycling
120 3 31 Judo
121 4 40 Triathlon
122 SECONDARY counters
123 Conflict algorithm counter diff :
124 ndb_conflict_fn_epoch2
125 0
126 ndb_conflict_fn_epoch2_trans
127 0
128 ndb_conflict_trans_reject_count
129 0
130 ndb_conflict_epoch_delete_delete_count
131 0
132 ndb_conflict_refresh_op_count
133 0
134 reflected_op_prepare_count_greater_than_zero
135 1
136 any_reflected_ops_applied
137 1
138 last_conflict_epoch_increased
139 1
140 conflict_handling_in_progess
141 1
142 stable_epoch_is_older_than_max_replicated
143 1
144 Look at PRIMARY exceptions table content
145 SELECT k, v$old, v$new, c$old, c$new, ndb$op_type, ndb$cft_cause from test.t1$EX order by ndb$count;
146 k v$old v$new c$old c$new ndb$op_type ndb$cft_cause
147 3 30 NULL Running NULL delete_row row_does_not_exist
148 Now check behaviour of Secondary when reflected ops should not be applied
149 -------------------------------------------------------------------------
150 The interpreted program attached to reflected ops at the Secondary slave
151 is intended to avoid an 'old' reflected op overwriting a 'new' locally
152 inserted row value. The end result should still be the same (the new
153 value will be applied later, but we should avoid having every modification
154 made at the secondary applied twice with some time lag as that will cause
155 chaos for Secondary applications)
156 Stop Slave on SECONDARY
157 STOP SLAVE;
158 Warnings:
159 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
160 Stop Slave on PRIMARY
161 STOP SLAVE;
162 Warnings:
163 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
164 Delete row 4 on PRIMARY
165 DELETE from test.t1 where k=4;
166 Primary state
167 select * from test.t1 order by k;
168 k v c
169 1 10 Swimming
170 2 20 Cycling
171 3 31 Judo
172 Delete row 4 on SECONDARY
173 DELETE from test.t1 where k=4;
174 Follow with INSERT on SECONDARY
175 INSERT into test.t1 values (4, 440, "Fell running");
176 Secondary state :
177 select * from test.t1 order by k;
178 k v c
179 1 10 Swimming
180 2 20 Cycling
181 3 31 Judo
182 4 440 Fell running
183 Allow Primary change to propagate to Secondary
184 (Which will delete the new, updated row on the Secondary)
185 START SLAVE;
186 Warnings:
187 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
188 Examine data on the SECONDARY - row 4 deleted
189 select * from test.t1 order by k;
190 k v c
191 1 10 Swimming
192 2 20 Cycling
193 3 31 Judo
194 Now allow the SECONDARY Binlog to propagate back to the PRIMARY
195 while blocking the return path...
196 STOP SLAVE;
197 Warnings:
198 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
199 START SLAVE;
200 Warnings:
201 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
202 Examine data on the PRIMARY - row 4 exists
203 as the PRIMARY's delete is not applied if present
204 select * from test.t1 order by k;
205 k v c
206 1 10 Swimming
207 2 20 Cycling
208 3 31 Judo
209 4 440 Fell running
210 Now stop the PRIMARY Slave - changes from the
211 SECONDARY cannot now reach the PRIMARY
212 STOP SLAVE;
213 Warnings:
214 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
215 Now go back to the SECONDARY and create a new
216 row version
217 First show there is no row 4 on the SECONDARY
218 select * from test.t1 order by k;
219 k v c
220 1 10 Swimming
221 2 20 Cycling
222 3 31 Judo
223 INSERT into test.t1 values (4, 4444, "Cyclo-cross");
224 select * from test.t1 order by k;
225 k v c
226 1 10 Swimming
227 2 20 Cycling
228 3 31 Judo
229 4 4444 Cyclo-cross
230 Now allow the Binlog of the PRIMARY (containing the
231 reflected DELETE + Insert (4, 440, "Fell running")
232 to be applied locally
233 The SECONDARY should reject this application
234 START SLAVE;
235 Warnings:
236 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
237 Examine data on the SECONDARY : Row 4 should be untouched
238 (4, 4444, "Cyclo-cross").
239 Insert will be rejected as row already exists.
240 select * from test.t1 order by k;
241 k v c
242 1 10 Swimming
243 2 20 Cycling
244 3 31 Judo
245 4 4444 Cyclo-cross
246 Show operation counter diff on the SECONDARY
247 Should show reflected op prepared + rejected.
248 Should show equal, non-zero reflected op prep+reject counts
249 Conflict algorithm counter diff :
250 ndb_conflict_fn_epoch2
251 0
252 ndb_conflict_fn_epoch2_trans
253 0
254 ndb_conflict_trans_reject_count
255 0
256 ndb_conflict_epoch_delete_delete_count
257 0
258 ndb_conflict_refresh_op_count
259 0
260 reflected_op_prepare_count_greater_than_zero
261 1
262 any_reflected_ops_applied
263 0
264 last_conflict_epoch_increased
265 0
266 conflict_handling_in_progess
267 0
268 stable_epoch_is_older_than_max_replicated
269 0
270 Ok, now allow SECONDARY Binlog to propagate to Primary
271 and realign it
272 START SLAVE;
273 Warnings:
274 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
275 Show data on PRIMARY
276 select * from test.t1 order by k;
277 k v c
278 1 10 Swimming
279 2 20 Cycling
280 3 31 Judo
281 4 440 Fell running
282 Allow reflection back to the SECONDARY...
283 Now show same for UPDATE, then DELETE
284 -------------------------------------
285 First stop SLAVEs
286 STOP SLAVE;
287 Warnings:
288 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
289 STOP SLAVE;
290 Warnings:
291 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
292 Now perform UPDATE 1 at Secondary
293 UPDATE test.t1 SET c="Bathing" where k=1;
294 Show data on Secondary
295 select * from test.t1 order by k;
296 k v c
297 1 10 Bathing
298 2 20 Cycling
299 3 31 Judo
300 4 440 Fell running
301 Data on Primary
302 select * from test.t1 order by k;
303 k v c
304 1 10 Swimming
305 2 20 Cycling
306 3 31 Judo
307 4 440 Fell running
308 Now propagate to Primary...
309 START SLAVE;
310 Warnings:
311 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
312 Updated data on Primary
313 select * from test.t1 order by k;
314 k v c
315 1 10 Bathing
316 2 20 Cycling
317 3 31 Judo
318 4 440 Fell running
319 Now stop Primary slave to stop further propagation
320 STOP SLAVE;
321 Warnings:
322 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
323 Now make update 2 on Secondary
324 update test.t1 SET c="Paddling" where k=1;
325 Data on Secondary
326 select * from test.t1 order by k;
327 k v c
328 1 10 Paddling
329 2 20 Cycling
330 3 31 Judo
331 4 440 Fell running
332 Now allow Primary binlog, containing reflected update op
333 setting column c of row 1 to "Bathing" to be applied
334 it should be rejected by the Secondary, and increment
335 the defined + rejected counts
336 START SLAVE;
337 Warnings:
338 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
339 Data on Secondary (should be unchanged)
340 select * from test.t1 order by k;
341 k v c
342 1 10 Paddling
343 2 20 Cycling
344 3 31 Judo
345 4 440 Fell running
346 Conflict counts on Secondary (incremented preped + rejected)
347 Conflict algorithm counter diff :
348 ndb_conflict_fn_epoch2
349 0
350 ndb_conflict_fn_epoch2_trans
351 0
352 ndb_conflict_trans_reject_count
353 0
354 ndb_conflict_epoch_delete_delete_count
355 0
356 ndb_conflict_refresh_op_count
357 1
358 reflected_op_prepare_count_greater_than_zero
359 1
360 any_reflected_ops_applied
361 0
362 last_conflict_epoch_increased
363 1
364 conflict_handling_in_progess
365 0
366 stable_epoch_is_older_than_max_replicated
367 0
368 Now allow sync...
369 START SLAVE;
370 Warnings:
371 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
372 Allowing the sync should have allowed the second update
373 (To 'Paddling') to be reflected, and rejected
374 Data on Secondary (should be unchanged)
375 select * from test.t1 order by k;
376 k v c
377 1 10 Paddling
378 2 20 Cycling
379 3 31 Judo
380 4 440 Fell running
381 Conflict counts on Secondary (incremented preped + rejected)
382 Conflict algorithm counter diff :
383 ndb_conflict_fn_epoch2
384 0
385 ndb_conflict_fn_epoch2_trans
386 0
387 ndb_conflict_trans_reject_count
388 0
389 ndb_conflict_epoch_delete_delete_count
390 0
391 ndb_conflict_refresh_op_count
392 1
393 reflected_op_prepare_count_greater_than_zero
394 1
395 any_reflected_ops_applied
396 0
397 last_conflict_epoch_increased
398 1
399 conflict_handling_in_progess
400 0
401 stable_epoch_is_older_than_max_replicated
402 0
403 Show same for DELETE
404 --------------------
405 First stop SLAVEs
406 STOP SLAVE;
407 Warnings:
408 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
409 STOP SLAVE;
410 Warnings:
411 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
412 Now perform DELETE of row 2 at Secondary
413 DELETE from test.t1 where k=2;
414 Show data on Secondary
415 select * from test.t1 order by k;
416 k v c
417 1 10 Paddling
418 3 31 Judo
419 4 440 Fell running
420 Data on Primary
421 select * from test.t1 order by k;
422 k v c
423 1 10 Paddling
424 2 20 Cycling
425 3 31 Judo
426 4 440 Fell running
427 Now propagate to Primary...
428 START SLAVE;
429 Warnings:
430 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
431 Updated data on Primary
432 select * from test.t1 order by k;
433 k v c
434 1 10 Paddling
435 3 31 Judo
436 4 440 Fell running
437 Now stop Primary slave to stop further propagation
438 STOP SLAVE;
439 Warnings:
440 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
441 Now make a further change on Secondary
442 INSERT into test.t1 VALUES (2, 22, "Rock-climbing");
443 Data on Secondary
444 select * from test.t1 order by k;
445 k v c
446 1 10 Paddling
447 2 22 Rock-climbing
448 3 31 Judo
449 4 440 Fell running
450 Now allow Primary binlog, containing reflected delete op
451 on row 2 to be applied it should be rejected by the
452 Secondary, and increment the defined + rejected counts
453 START SLAVE;
454 Warnings:
455 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
456 Data on Secondary (should be unchanged)
457 select * from test.t1 order by k;
458 k v c
459 1 10 Paddling
460 2 22 Rock-climbing
461 3 31 Judo
462 4 440 Fell running
463 Conflict counts on Secondary (incremented preped + rejected)
464 Conflict algorithm counter diff :
465 ndb_conflict_fn_epoch2
466 0
467 ndb_conflict_fn_epoch2_trans
468 0
469 ndb_conflict_trans_reject_count
470 0
471 ndb_conflict_epoch_delete_delete_count
472 0
473 ndb_conflict_refresh_op_count
474 0
475 reflected_op_prepare_count_greater_than_zero
476 1
477 any_reflected_ops_applied
478 0
479 last_conflict_epoch_increased
480 0
481 conflict_handling_in_progess
482 0
483 stable_epoch_is_older_than_max_replicated
484 0
485 Now allow sync...
486 START SLAVE;
487 Warnings:
488 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
489 Allowing the sync should have allowed the insert
490 (To 'Rock-climbing') to be reflected, and rejected
491 Data on Secondary (should be unchanged)
492 select * from test.t1 order by k;
493 k v c
494 1 10 Paddling
495 2 22 Rock-climbing
496 3 31 Judo
497 4 440 Fell running
498 Conflict counts on Secondary (incremented preped + rejected)
499 Conflict algorithm counter diff :
500 ndb_conflict_fn_epoch2
501 0
502 ndb_conflict_fn_epoch2_trans
503 0
504 ndb_conflict_trans_reject_count
505 0
506 ndb_conflict_epoch_delete_delete_count
507 0
508 ndb_conflict_refresh_op_count
509 0
510 reflected_op_prepare_count_greater_than_zero
511 1
512 any_reflected_ops_applied
513 0
514 last_conflict_epoch_increased
515 0
516 conflict_handling_in_progess
517 0
518 stable_epoch_is_older_than_max_replicated
519 0
520 Primary insert-delete obscures Secondary insert problem
521 -------------------------------------------------------
522 Stop slaves in both directions
523 STOP SLAVE;
524 Warnings:
525 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
526 STOP SLAVE;
527 Warnings:
528 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
529 Start with non-existent row (5, 50, "Disco dancing") on primary
530 insert into test.t1 values (5, 50, "Disco dancing");
531 select * from test.t1 order by k;
532 k v c
533 1 10 Paddling
534 2 22 Rock-climbing
535 3 31 Judo
536 4 440 Fell running
537 5 50 Disco dancing
538 Reset conflict counters on Primary
539 Empty exceptions table on Primary
540 DELETE from test.t1$EX;
541 Insert non-existent row (5, 500, "Line dancing") on secondary
542 insert into test.t1 values (5, 500, "Line dancing");
543 select * from test.t1 order by k;
544 k v c
545 1 10 Paddling
546 2 22 Rock-climbing
547 3 31 Judo
548 4 440 Fell running
549 5 500 Line dancing
550 Reset conflict counters on Secondary
551 Allow Primary insert to trample Secondary insert.
552 START SLAVE;
553 Warnings:
554 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
555 select * from test.t1 order by k;
556 k v c
557 1 10 Paddling
558 2 22 Rock-climbing
559 3 31 Judo
560 4 440 Fell running
561 5 50 Disco dancing
562 Secondary now updates the row set by the Primary
563 update test.t1 set v=v+5 where k=5;
564 select * from test.t1 order by k;
565 k v c
566 1 10 Paddling
567 2 22 Rock-climbing
568 3 31 Judo
569 4 440 Fell running
570 5 55 Disco dancing
571 Stop Secondary Slave again
572 STOP SLAVE;
573 Warnings:
574 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
575 Now delete row from the primary
576 delete from test.t1 where k=5;
577 select * from test.t1 order by k;
578 k v c
579 1 10 Paddling
580 2 22 Rock-climbing
581 3 31 Judo
582 4 440 Fell running
583 Now allow Secondary writes to propagate to Primary
584 START SLAVE;
585 Warnings:
586 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
587 Expect that the Secondary insert succeeded as no row existed
588 on arrival, but then the secondary row was trampled by the
589 primary, and then a secondary update was applied...
590 So what do we see at the Primary?
591 select * from test.t1 order by k;
592 k v c
593 1 10 Paddling
594 2 22 Rock-climbing
595 3 31 Judo
596 4 440 Fell running
597 5 55 Disco dancing
598 Show primary conflict info counter diff - expect nothing.
599 Conflict algorithm counter diff :
600 ndb_conflict_fn_epoch2
601 0
602 ndb_conflict_fn_epoch2_trans
603 0
604 ndb_conflict_trans_reject_count
605 0
606 ndb_conflict_epoch_delete_delete_count
607 0
608 ndb_conflict_refresh_op_count
609 0
610 reflected_op_prepare_count_greater_than_zero
611 0
612 any_reflected_ops_applied
613 0
614 last_conflict_epoch_increased
615 0
616 conflict_handling_in_progess
617 0
618 stable_epoch_is_older_than_max_replicated
619 0
620 Show primary's exceptions table content - expect there to be none.
621 SELECT k, v$old, v$new, c$old, c$new, ndb$op_type, ndb$cft_cause from test.t1$EX order by ndb$count;
622 k v$old v$new c$old c$new ndb$op_type ndb$cft_cause
623 Now allow Primary changes to propagate back to Secondary
624 START SLAVE;
625 Warnings:
626 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
627 Look at Secondary content
628 select * from test.t1 order by k;
629 k v c
630 1 10 Paddling
631 2 22 Rock-climbing
632 3 31 Judo
633 4 440 Fell running
634 5 55 Disco dancing
635 Look at Secondary conflict counters diff - showing
636 reflected ops applied on Secondary
637 Conflict algorithm counter diff :
638 ndb_conflict_fn_epoch2
639 0
640 ndb_conflict_fn_epoch2_trans
641 0
642 ndb_conflict_trans_reject_count
643 0
644 ndb_conflict_epoch_delete_delete_count
645 0
646 ndb_conflict_refresh_op_count
647 0
648 reflected_op_prepare_count_greater_than_zero
649 1
650 any_reflected_ops_applied
651 1
652 last_conflict_epoch_increased
653 1
654 conflict_handling_in_progess
655 1
656 stable_epoch_is_older_than_max_replicated
657 1
658 select * from test.t1 order by k;
659 k v c
660 1 10 Paddling
661 2 22 Rock-climbing
662 3 31 Judo
663 4 440 Fell running
664 5 55 Disco dancing
665 Iteration 3
666 STOP SLAVE;
667 Warnings:
668 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
669 DELETE FROM test.t1$EX;
670 set global ndb_applier_conflict_role="SECONDARY";
671 STOP SLAVE;
672 Warnings:
673 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
674 DELETE FROM test.t1$EX;
675 set global ndb_applier_conflict_role="PRIMARY";
676 Setup S1 P2
677 delete from test.t1;
678 insert into test.t1 values
679 (1,10, "Swimming"),
680 (2,20, "Cycling"),
681 (3,30, "Running"),
682 (4,40, "Triathlon");
683 START SLAVE;
684 Warnings:
685 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
686 START SLAVE;
687 Warnings:
688 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
689 Content on PRIMARY
690 select * from test.t1 order by k;
691 k v c
692 1 10 Swimming
693 2 20 Cycling
694 3 30 Running
695 4 40 Triathlon
696 Content on SECONDARY
697 select * from test.t1 order by k;
698 k v c
699 1 10 Swimming
700 2 20 Cycling
701 3 30 Running
702 4 40 Triathlon
703 Basic delete-delete cases
704 -------------------------
705 Stop Slave on SECONDARY
706 STOP SLAVE;
707 Warnings:
708 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
709 Delete row 3 on PRIMARY
710 delete from t1 where k=3;
711 Delete row 3 on SECONDARY
712 delete from t1 where k=3;
713 Insert replacement row on SECONDARY
714 This is likely to go in the same SECONDARY epoch transaction
715 insert into t1 values (3,31, "Judo");
716 Wait for SECONDARY change to apply on PRIMARY
717 Expect it to apply correctly here as the PRIMARY
718 has no track of its outstanding DELETE
719
720 PRIMARY content
721 select * from test.t1 order by k;
722 k v c
723 1 10 Swimming
724 2 20 Cycling
725 3 31 Judo
726 4 40 Triathlon
727 PRIMARY counters
728 Conflict algorithm counter diff :
729 ndb_conflict_fn_epoch2
730 1
731 ndb_conflict_fn_epoch2_trans
732 0
733 ndb_conflict_trans_reject_count
734 0
735 ndb_conflict_epoch_delete_delete_count
736 1
737 ndb_conflict_refresh_op_count
738 0
739 reflected_op_prepare_count_greater_than_zero
740 0
741 any_reflected_ops_applied
742 0
743 last_conflict_epoch_increased
744 1
745 conflict_handling_in_progess
746 1
747 stable_epoch_is_older_than_max_replicated
748 0
749 Re-enable SECONDARY Slave, and check state there
750 START SLAVE;
751 Warnings:
752 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
753 SECONDARY content
754 select * from test.t1 order by k;
755 k v c
756 1 10 Swimming
757 2 20 Cycling
758 3 31 Judo
759 4 40 Triathlon
760 SECONDARY counters
761 Conflict algorithm counter diff :
762 ndb_conflict_fn_epoch2
763 0
764 ndb_conflict_fn_epoch2_trans
765 0
766 ndb_conflict_trans_reject_count
767 0
768 ndb_conflict_epoch_delete_delete_count
769 0
770 ndb_conflict_refresh_op_count
771 0
772 reflected_op_prepare_count_greater_than_zero
773 1
774 any_reflected_ops_applied
775 1
776 last_conflict_epoch_increased
777 1
778 conflict_handling_in_progess
779 1
780 stable_epoch_is_older_than_max_replicated
781 1
782 Look at PRIMARY exceptions table content
783 SELECT k, v$old, v$new, c$old, c$new, ndb$op_type, ndb$cft_cause from test.t1$EX order by ndb$count;
784 k v$old v$new c$old c$new ndb$op_type ndb$cft_cause
785 3 30 NULL Running NULL delete_row row_does_not_exist
786 Now check behaviour of Secondary when reflected ops should not be applied
787 -------------------------------------------------------------------------
788 The interpreted program attached to reflected ops at the Secondary slave
789 is intended to avoid an 'old' reflected op overwriting a 'new' locally
790 inserted row value. The end result should still be the same (the new
791 value will be applied later, but we should avoid having every modification
792 made at the secondary applied twice with some time lag as that will cause
793 chaos for Secondary applications)
794 Stop Slave on SECONDARY
795 STOP SLAVE;
796 Warnings:
797 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
798 Stop Slave on PRIMARY
799 STOP SLAVE;
800 Warnings:
801 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
802 Delete row 4 on PRIMARY
803 DELETE from test.t1 where k=4;
804 Primary state
805 select * from test.t1 order by k;
806 k v c
807 1 10 Swimming
808 2 20 Cycling
809 3 31 Judo
810 Delete row 4 on SECONDARY
811 DELETE from test.t1 where k=4;
812 Follow with INSERT on SECONDARY
813 INSERT into test.t1 values (4, 440, "Fell running");
814 Secondary state :
815 select * from test.t1 order by k;
816 k v c
817 1 10 Swimming
818 2 20 Cycling
819 3 31 Judo
820 4 440 Fell running
821 Allow Primary change to propagate to Secondary
822 (Which will delete the new, updated row on the Secondary)
823 START SLAVE;
824 Warnings:
825 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
826 Examine data on the SECONDARY - row 4 deleted
827 select * from test.t1 order by k;
828 k v c
829 1 10 Swimming
830 2 20 Cycling
831 3 31 Judo
832 Now allow the SECONDARY Binlog to propagate back to the PRIMARY
833 while blocking the return path...
834 STOP SLAVE;
835 Warnings:
836 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
837 START SLAVE;
838 Warnings:
839 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
840 Examine data on the PRIMARY - row 4 exists
841 as the PRIMARY's delete is not applied if present
842 select * from test.t1 order by k;
843 k v c
844 1 10 Swimming
845 2 20 Cycling
846 3 31 Judo
847 4 440 Fell running
848 Now stop the PRIMARY Slave - changes from the
849 SECONDARY cannot now reach the PRIMARY
850 STOP SLAVE;
851 Warnings:
852 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
853 Now go back to the SECONDARY and create a new
854 row version
855 First show there is no row 4 on the SECONDARY
856 select * from test.t1 order by k;
857 k v c
858 1 10 Swimming
859 2 20 Cycling
860 3 31 Judo
861 INSERT into test.t1 values (4, 4444, "Cyclo-cross");
862 select * from test.t1 order by k;
863 k v c
864 1 10 Swimming
865 2 20 Cycling
866 3 31 Judo
867 4 4444 Cyclo-cross
868 Now allow the Binlog of the PRIMARY (containing the
869 reflected DELETE + Insert (4, 440, "Fell running")
870 to be applied locally
871 The SECONDARY should reject this application
872 START SLAVE;
873 Warnings:
874 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
875 Examine data on the SECONDARY : Row 4 should be untouched
876 (4, 4444, "Cyclo-cross").
877 Insert will be rejected as row already exists.
878 select * from test.t1 order by k;
879 k v c
880 1 10 Swimming
881 2 20 Cycling
882 3 31 Judo
883 4 4444 Cyclo-cross
884 Show operation counter diff on the SECONDARY
885 Should show reflected op prepared + rejected.
886 Should show equal, non-zero reflected op prep+reject counts
887 Conflict algorithm counter diff :
888 ndb_conflict_fn_epoch2
889 0
890 ndb_conflict_fn_epoch2_trans
891 0
892 ndb_conflict_trans_reject_count
893 0
894 ndb_conflict_epoch_delete_delete_count
895 0
896 ndb_conflict_refresh_op_count
897 0
898 reflected_op_prepare_count_greater_than_zero
899 1
900 any_reflected_ops_applied
901 0
902 last_conflict_epoch_increased
903 0
904 conflict_handling_in_progess
905 0
906 stable_epoch_is_older_than_max_replicated
907 0
908 Ok, now allow SECONDARY Binlog to propagate to Primary
909 and realign it
910 START SLAVE;
911 Warnings:
912 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
913 Show data on PRIMARY
914 select * from test.t1 order by k;
915 k v c
916 1 10 Swimming
917 2 20 Cycling
918 3 31 Judo
919 4 440 Fell running
920 Allow reflection back to the SECONDARY...
921 Now show same for UPDATE, then DELETE
922 -------------------------------------
923 First stop SLAVEs
924 STOP SLAVE;
925 Warnings:
926 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
927 STOP SLAVE;
928 Warnings:
929 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
930 Now perform UPDATE 1 at Secondary
931 UPDATE test.t1 SET c="Bathing" where k=1;
932 Show data on Secondary
933 select * from test.t1 order by k;
934 k v c
935 1 10 Bathing
936 2 20 Cycling
937 3 31 Judo
938 4 440 Fell running
939 Data on Primary
940 select * from test.t1 order by k;
941 k v c
942 1 10 Swimming
943 2 20 Cycling
944 3 31 Judo
945 4 440 Fell running
946 Now propagate to Primary...
947 START SLAVE;
948 Warnings:
949 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
950 Updated data on Primary
951 select * from test.t1 order by k;
952 k v c
953 1 10 Bathing
954 2 20 Cycling
955 3 31 Judo
956 4 440 Fell running
957 Now stop Primary slave to stop further propagation
958 STOP SLAVE;
959 Warnings:
960 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
961 Now make update 2 on Secondary
962 update test.t1 SET c="Paddling" where k=1;
963 Data on Secondary
964 select * from test.t1 order by k;
965 k v c
966 1 10 Paddling
967 2 20 Cycling
968 3 31 Judo
969 4 440 Fell running
970 Now allow Primary binlog, containing reflected update op
971 setting column c of row 1 to "Bathing" to be applied
972 it should be rejected by the Secondary, and increment
973 the defined + rejected counts
974 START SLAVE;
975 Warnings:
976 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
977 Data on Secondary (should be unchanged)
978 select * from test.t1 order by k;
979 k v c
980 1 10 Paddling
981 2 20 Cycling
982 3 31 Judo
983 4 440 Fell running
984 Conflict counts on Secondary (incremented preped + rejected)
985 Conflict algorithm counter diff :
986 ndb_conflict_fn_epoch2
987 0
988 ndb_conflict_fn_epoch2_trans
989 0
990 ndb_conflict_trans_reject_count
991 0
992 ndb_conflict_epoch_delete_delete_count
993 0
994 ndb_conflict_refresh_op_count
995 1
996 reflected_op_prepare_count_greater_than_zero
997 1
998 any_reflected_ops_applied
999 0
1000 last_conflict_epoch_increased
1001 1
1002 conflict_handling_in_progess
1003 0
1004 stable_epoch_is_older_than_max_replicated
1005 0
1006 Now allow sync...
1007 START SLAVE;
1008 Warnings:
1009 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
1010 Allowing the sync should have allowed the second update
1011 (To 'Paddling') to be reflected, and rejected
1012 Data on Secondary (should be unchanged)
1013 select * from test.t1 order by k;
1014 k v c
1015 1 10 Paddling
1016 2 20 Cycling
1017 3 31 Judo
1018 4 440 Fell running
1019 Conflict counts on Secondary (incremented preped + rejected)
1020 Conflict algorithm counter diff :
1021 ndb_conflict_fn_epoch2
1022 0
1023 ndb_conflict_fn_epoch2_trans
1024 0
1025 ndb_conflict_trans_reject_count
1026 0
1027 ndb_conflict_epoch_delete_delete_count
1028 0
1029 ndb_conflict_refresh_op_count
1030 1
1031 reflected_op_prepare_count_greater_than_zero
1032 1
1033 any_reflected_ops_applied
1034 0
1035 last_conflict_epoch_increased
1036 1
1037 conflict_handling_in_progess
1038 0
1039 stable_epoch_is_older_than_max_replicated
1040 0
1041 Show same for DELETE
1042 --------------------
1043 First stop SLAVEs
1044 STOP SLAVE;
1045 Warnings:
1046 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
1047 STOP SLAVE;
1048 Warnings:
1049 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
1050 Now perform DELETE of row 2 at Secondary
1051 DELETE from test.t1 where k=2;
1052 Show data on Secondary
1053 select * from test.t1 order by k;
1054 k v c
1055 1 10 Paddling
1056 3 31 Judo
1057 4 440 Fell running
1058 Data on Primary
1059 select * from test.t1 order by k;
1060 k v c
1061 1 10 Paddling
1062 2 20 Cycling
1063 3 31 Judo
1064 4 440 Fell running
1065 Now propagate to Primary...
1066 START SLAVE;
1067 Warnings:
1068 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
1069 Updated data on Primary
1070 select * from test.t1 order by k;
1071 k v c
1072 1 10 Paddling
1073 3 31 Judo
1074 4 440 Fell running
1075 Now stop Primary slave to stop further propagation
1076 STOP SLAVE;
1077 Warnings:
1078 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
1079 Now make a further change on Secondary
1080 INSERT into test.t1 VALUES (2, 22, "Rock-climbing");
1081 Data on Secondary
1082 select * from test.t1 order by k;
1083 k v c
1084 1 10 Paddling
1085 2 22 Rock-climbing
1086 3 31 Judo
1087 4 440 Fell running
1088 Now allow Primary binlog, containing reflected delete op
1089 on row 2 to be applied it should be rejected by the
1090 Secondary, and increment the defined + rejected counts
1091 START SLAVE;
1092 Warnings:
1093 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
1094 Data on Secondary (should be unchanged)
1095 select * from test.t1 order by k;
1096 k v c
1097 1 10 Paddling
1098 2 22 Rock-climbing
1099 3 31 Judo
1100 4 440 Fell running
1101 Conflict counts on Secondary (incremented preped + rejected)
1102 Conflict algorithm counter diff :
1103 ndb_conflict_fn_epoch2
1104 0
1105 ndb_conflict_fn_epoch2_trans
1106 0
1107 ndb_conflict_trans_reject_count
1108 0
1109 ndb_conflict_epoch_delete_delete_count
1110 0
1111 ndb_conflict_refresh_op_count
1112 0
1113 reflected_op_prepare_count_greater_than_zero
1114 1
1115 any_reflected_ops_applied
1116 0
1117 last_conflict_epoch_increased
1118 0
1119 conflict_handling_in_progess
1120 0
1121 stable_epoch_is_older_than_max_replicated
1122 0
1123 Now allow sync...
1124 START SLAVE;
1125 Warnings:
1126 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
1127 Allowing the sync should have allowed the insert
1128 (To 'Rock-climbing') to be reflected, and rejected
1129 Data on Secondary (should be unchanged)
1130 select * from test.t1 order by k;
1131 k v c
1132 1 10 Paddling
1133 2 22 Rock-climbing
1134 3 31 Judo
1135 4 440 Fell running
1136 Conflict counts on Secondary (incremented preped + rejected)
1137 Conflict algorithm counter diff :
1138 ndb_conflict_fn_epoch2
1139 0
1140 ndb_conflict_fn_epoch2_trans
1141 0
1142 ndb_conflict_trans_reject_count
1143 0
1144 ndb_conflict_epoch_delete_delete_count
1145 0
1146 ndb_conflict_refresh_op_count
1147 0
1148 reflected_op_prepare_count_greater_than_zero
1149 1
1150 any_reflected_ops_applied
1151 0
1152 last_conflict_epoch_increased
1153 0
1154 conflict_handling_in_progess
1155 0
1156 stable_epoch_is_older_than_max_replicated
1157 0
1158 Primary insert-delete obscures Secondary insert problem
1159 -------------------------------------------------------
1160 Stop slaves in both directions
1161 STOP SLAVE;
1162 Warnings:
1163 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
1164 STOP SLAVE;
1165 Warnings:
1166 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
1167 Start with non-existent row (5, 50, "Disco dancing") on primary
1168 insert into test.t1 values (5, 50, "Disco dancing");
1169 select * from test.t1 order by k;
1170 k v c
1171 1 10 Paddling
1172 2 22 Rock-climbing
1173 3 31 Judo
1174 4 440 Fell running
1175 5 50 Disco dancing
1176 Reset conflict counters on Primary
1177 Empty exceptions table on Primary
1178 DELETE from test.t1$EX;
1179 Insert non-existent row (5, 500, "Line dancing") on secondary
1180 insert into test.t1 values (5, 500, "Line dancing");
1181 select * from test.t1 order by k;
1182 k v c
1183 1 10 Paddling
1184 2 22 Rock-climbing
1185 3 31 Judo
1186 4 440 Fell running
1187 5 500 Line dancing
1188 Reset conflict counters on Secondary
1189 Allow Primary insert to trample Secondary insert.
1190 START SLAVE;
1191 Warnings:
1192 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
1193 select * from test.t1 order by k;
1194 k v c
1195 1 10 Paddling
1196 2 22 Rock-climbing
1197 3 31 Judo
1198 4 440 Fell running
1199 5 50 Disco dancing
1200 Secondary now updates the row set by the Primary
1201 update test.t1 set v=v+5 where k=5;
1202 select * from test.t1 order by k;
1203 k v c
1204 1 10 Paddling
1205 2 22 Rock-climbing
1206 3 31 Judo
1207 4 440 Fell running
1208 5 55 Disco dancing
1209 Stop Secondary Slave again
1210 STOP SLAVE;
1211 Warnings:
1212 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
1213 Now delete row from the primary
1214 delete from test.t1 where k=5;
1215 select * from test.t1 order by k;
1216 k v c
1217 1 10 Paddling
1218 2 22 Rock-climbing
1219 3 31 Judo
1220 4 440 Fell running
1221 Now allow Secondary writes to propagate to Primary
1222 START SLAVE;
1223 Warnings:
1224 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
1225 Expect that the Secondary insert succeeded as no row existed
1226 on arrival, but then the secondary row was trampled by the
1227 primary, and then a secondary update was applied...
1228 So what do we see at the Primary?
1229 select * from test.t1 order by k;
1230 k v c
1231 1 10 Paddling
1232 2 22 Rock-climbing
1233 3 31 Judo
1234 4 440 Fell running
1235 5 55 Disco dancing
1236 Show primary conflict info counter diff - expect nothing.
1237 Conflict algorithm counter diff :
1238 ndb_conflict_fn_epoch2
1239 0
1240 ndb_conflict_fn_epoch2_trans
1241 0
1242 ndb_conflict_trans_reject_count
1243 0
1244 ndb_conflict_epoch_delete_delete_count
1245 0
1246 ndb_conflict_refresh_op_count
1247 0
1248 reflected_op_prepare_count_greater_than_zero
1249 0
1250 any_reflected_ops_applied
1251 0
1252 last_conflict_epoch_increased
1253 0
1254 conflict_handling_in_progess
1255 0
1256 stable_epoch_is_older_than_max_replicated
1257 0
1258 Show primary's exceptions table content - expect there to be none.
1259 SELECT k, v$old, v$new, c$old, c$new, ndb$op_type, ndb$cft_cause from test.t1$EX order by ndb$count;
1260 k v$old v$new c$old c$new ndb$op_type ndb$cft_cause
1261 Now allow Primary changes to propagate back to Secondary
1262 START SLAVE;
1263 Warnings:
1264 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
1265 Look at Secondary content
1266 select * from test.t1 order by k;
1267 k v c
1268 1 10 Paddling
1269 2 22 Rock-climbing
1270 3 31 Judo
1271 4 440 Fell running
1272 5 55 Disco dancing
1273 Look at Secondary conflict counters diff - showing
1274 reflected ops applied on Secondary
1275 Conflict algorithm counter diff :
1276 ndb_conflict_fn_epoch2
1277 0
1278 ndb_conflict_fn_epoch2_trans
1279 0
1280 ndb_conflict_trans_reject_count
1281 0
1282 ndb_conflict_epoch_delete_delete_count
1283 0
1284 ndb_conflict_refresh_op_count
1285 0
1286 reflected_op_prepare_count_greater_than_zero
1287 1
1288 any_reflected_ops_applied
1289 1
1290 last_conflict_epoch_increased
1291 1
1292 conflict_handling_in_progess
1293 1
1294 stable_epoch_is_older_than_max_replicated
1295 1
1296 select * from test.t1 order by k;
1297 k v c
1298 1 10 Paddling
1299 2 22 Rock-climbing
1300 3 31 Judo
1301 4 440 Fell running
1302 5 55 Disco dancing
1303 Iteration 2
1304 STOP SLAVE;
1305 Warnings:
1306 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
1307 DELETE FROM test.t1$EX;
1308 set global ndb_applier_conflict_role="SECONDARY";
1309 STOP SLAVE;
1310 Warnings:
1311 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
1312 DELETE FROM test.t1$EX;
1313 set global ndb_applier_conflict_role="PRIMARY";
1314 Setup P1 S2
1315 delete from test.t1;
1316 insert into test.t1 values
1317 (1,10, "Swimming"),
1318 (2,20, "Cycling"),
1319 (3,30, "Running"),
1320 (4,40, "Triathlon");
1321 START SLAVE;
1322 Warnings:
1323 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
1324 START SLAVE;
1325 Warnings:
1326 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
1327 Content on PRIMARY
1328 select * from test.t1 order by k;
1329 k v c
1330 1 10 Swimming
1331 2 20 Cycling
1332 3 30 Running
1333 4 40 Triathlon
1334 Content on SECONDARY
1335 select * from test.t1 order by k;
1336 k v c
1337 1 10 Swimming
1338 2 20 Cycling
1339 3 30 Running
1340 4 40 Triathlon
1341 Basic delete-delete cases
1342 -------------------------
1343 Stop Slave on SECONDARY
1344 STOP SLAVE;
1345 Warnings:
1346 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
1347 Delete row 3 on PRIMARY
1348 delete from t1 where k=3;
1349 Delete row 3 on SECONDARY
1350 delete from t1 where k=3;
1351 Insert replacement row on SECONDARY
1352 This is likely to go in the same SECONDARY epoch transaction
1353 insert into t1 values (3,31, "Judo");
1354 Wait for SECONDARY change to apply on PRIMARY
1355 Expect it to apply correctly here as the PRIMARY
1356 has no track of its outstanding DELETE
1357
1358 PRIMARY content
1359 select * from test.t1 order by k;
1360 k v c
1361 1 10 Swimming
1362 2 20 Cycling
1363 3 31 Judo
1364 4 40 Triathlon
1365 PRIMARY counters
1366 Conflict algorithm counter diff :
1367 ndb_conflict_fn_epoch2
1368 1
1369 ndb_conflict_fn_epoch2_trans
1370 0
1371 ndb_conflict_trans_reject_count
1372 0
1373 ndb_conflict_epoch_delete_delete_count
1374 1
1375 ndb_conflict_refresh_op_count
1376 0
1377 reflected_op_prepare_count_greater_than_zero
1378 0
1379 any_reflected_ops_applied
1380 0
1381 last_conflict_epoch_increased
1382 1
1383 conflict_handling_in_progess
1384 1
1385 stable_epoch_is_older_than_max_replicated
1386 0
1387 Re-enable SECONDARY Slave, and check state there
1388 START SLAVE;
1389 Warnings:
1390 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
1391 SECONDARY content
1392 select * from test.t1 order by k;
1393 k v c
1394 1 10 Swimming
1395 2 20 Cycling
1396 3 31 Judo
1397 4 40 Triathlon
1398 SECONDARY counters
1399 Conflict algorithm counter diff :
1400 ndb_conflict_fn_epoch2
1401 0
1402 ndb_conflict_fn_epoch2_trans
1403 0
1404 ndb_conflict_trans_reject_count
1405 0
1406 ndb_conflict_epoch_delete_delete_count
1407 0
1408 ndb_conflict_refresh_op_count
1409 0
1410 reflected_op_prepare_count_greater_than_zero
1411 1
1412 any_reflected_ops_applied
1413 1
1414 last_conflict_epoch_increased
1415 1
1416 conflict_handling_in_progess
1417 1
1418 stable_epoch_is_older_than_max_replicated
1419 1
1420 Look at PRIMARY exceptions table content
1421 SELECT k, v$old, v$new, c$old, c$new, ndb$op_type, ndb$cft_cause from test.t1$EX order by ndb$count;
1422 k v$old v$new c$old c$new ndb$op_type ndb$cft_cause
1423 3 30 NULL Running NULL delete_row row_does_not_exist
1424 Now check behaviour of Secondary when reflected ops should not be applied
1425 -------------------------------------------------------------------------
1426 The interpreted program attached to reflected ops at the Secondary slave
1427 is intended to avoid an 'old' reflected op overwriting a 'new' locally
1428 inserted row value. The end result should still be the same (the new
1429 value will be applied later, but we should avoid having every modification
1430 made at the secondary applied twice with some time lag as that will cause
1431 chaos for Secondary applications)
1432 Stop Slave on SECONDARY
1433 STOP SLAVE;
1434 Warnings:
1435 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
1436 Stop Slave on PRIMARY
1437 STOP SLAVE;
1438 Warnings:
1439 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
1440 Delete row 4 on PRIMARY
1441 DELETE from test.t1 where k=4;
1442 Primary state
1443 select * from test.t1 order by k;
1444 k v c
1445 1 10 Swimming
1446 2 20 Cycling
1447 3 31 Judo
1448 Delete row 4 on SECONDARY
1449 DELETE from test.t1 where k=4;
1450 Follow with INSERT on SECONDARY
1451 INSERT into test.t1 values (4, 440, "Fell running");
1452 Secondary state :
1453 select * from test.t1 order by k;
1454 k v c
1455 1 10 Swimming
1456 2 20 Cycling
1457 3 31 Judo
1458 4 440 Fell running
1459 Allow Primary change to propagate to Secondary
1460 (Which will delete the new, updated row on the Secondary)
1461 START SLAVE;
1462 Warnings:
1463 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
1464 Examine data on the SECONDARY - row 4 deleted
1465 select * from test.t1 order by k;
1466 k v c
1467 1 10 Swimming
1468 2 20 Cycling
1469 3 31 Judo
1470 Now allow the SECONDARY Binlog to propagate back to the PRIMARY
1471 while blocking the return path...
1472 STOP SLAVE;
1473 Warnings:
1474 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
1475 START SLAVE;
1476 Warnings:
1477 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
1478 Examine data on the PRIMARY - row 4 exists
1479 as the PRIMARY's delete is not applied if present
1480 select * from test.t1 order by k;
1481 k v c
1482 1 10 Swimming
1483 2 20 Cycling
1484 3 31 Judo
1485 4 440 Fell running
1486 Now stop the PRIMARY Slave - changes from the
1487 SECONDARY cannot now reach the PRIMARY
1488 STOP SLAVE;
1489 Warnings:
1490 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
1491 Now go back to the SECONDARY and create a new
1492 row version
1493 First show there is no row 4 on the SECONDARY
1494 select * from test.t1 order by k;
1495 k v c
1496 1 10 Swimming
1497 2 20 Cycling
1498 3 31 Judo
1499 INSERT into test.t1 values (4, 4444, "Cyclo-cross");
1500 select * from test.t1 order by k;
1501 k v c
1502 1 10 Swimming
1503 2 20 Cycling
1504 3 31 Judo
1505 4 4444 Cyclo-cross
1506 Now allow the Binlog of the PRIMARY (containing the
1507 reflected DELETE + Insert (4, 440, "Fell running")
1508 to be applied locally
1509 The SECONDARY should reject this application
1510 START SLAVE;
1511 Warnings:
1512 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
1513 Examine data on the SECONDARY : Row 4 should be untouched
1514 (4, 4444, "Cyclo-cross").
1515 Insert will be rejected as row already exists.
1516 select * from test.t1 order by k;
1517 k v c
1518 1 10 Swimming
1519 2 20 Cycling
1520 3 31 Judo
1521 4 4444 Cyclo-cross
1522 Show operation counter diff on the SECONDARY
1523 Should show reflected op prepared + rejected.
1524 Should show equal, non-zero reflected op prep+reject counts
1525 Conflict algorithm counter diff :
1526 ndb_conflict_fn_epoch2
1527 0
1528 ndb_conflict_fn_epoch2_trans
1529 0
1530 ndb_conflict_trans_reject_count
1531 0
1532 ndb_conflict_epoch_delete_delete_count
1533 0
1534 ndb_conflict_refresh_op_count
1535 0
1536 reflected_op_prepare_count_greater_than_zero
1537 1
1538 any_reflected_ops_applied
1539 0
1540 last_conflict_epoch_increased
1541 0
1542 conflict_handling_in_progess
1543 0
1544 stable_epoch_is_older_than_max_replicated
1545 0
1546 Ok, now allow SECONDARY Binlog to propagate to Primary
1547 and realign it
1548 START SLAVE;
1549 Warnings:
1550 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
1551 Show data on PRIMARY
1552 select * from test.t1 order by k;
1553 k v c
1554 1 10 Swimming
1555 2 20 Cycling
1556 3 31 Judo
1557 4 440 Fell running
1558 Allow reflection back to the SECONDARY...
1559 Now show same for UPDATE, then DELETE
1560 -------------------------------------
1561 First stop SLAVEs
1562 STOP SLAVE;
1563 Warnings:
1564 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
1565 STOP SLAVE;
1566 Warnings:
1567 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
1568 Now perform UPDATE 1 at Secondary
1569 UPDATE test.t1 SET c="Bathing" where k=1;
1570 Show data on Secondary
1571 select * from test.t1 order by k;
1572 k v c
1573 1 10 Bathing
1574 2 20 Cycling
1575 3 31 Judo
1576 4 440 Fell running
1577 Data on Primary
1578 select * from test.t1 order by k;
1579 k v c
1580 1 10 Swimming
1581 2 20 Cycling
1582 3 31 Judo
1583 4 440 Fell running
1584 Now propagate to Primary...
1585 START SLAVE;
1586 Warnings:
1587 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
1588 Updated data on Primary
1589 select * from test.t1 order by k;
1590 k v c
1591 1 10 Bathing
1592 2 20 Cycling
1593 3 31 Judo
1594 4 440 Fell running
1595 Now stop Primary slave to stop further propagation
1596 STOP SLAVE;
1597 Warnings:
1598 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
1599 Now make update 2 on Secondary
1600 update test.t1 SET c="Paddling" where k=1;
1601 Data on Secondary
1602 select * from test.t1 order by k;
1603 k v c
1604 1 10 Paddling
1605 2 20 Cycling
1606 3 31 Judo
1607 4 440 Fell running
1608 Now allow Primary binlog, containing reflected update op
1609 setting column c of row 1 to "Bathing" to be applied
1610 it should be rejected by the Secondary, and increment
1611 the defined + rejected counts
1612 START SLAVE;
1613 Warnings:
1614 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
1615 Data on Secondary (should be unchanged)
1616 select * from test.t1 order by k;
1617 k v c
1618 1 10 Paddling
1619 2 20 Cycling
1620 3 31 Judo
1621 4 440 Fell running
1622 Conflict counts on Secondary (incremented preped + rejected)
1623 Conflict algorithm counter diff :
1624 ndb_conflict_fn_epoch2
1625 0
1626 ndb_conflict_fn_epoch2_trans
1627 0
1628 ndb_conflict_trans_reject_count
1629 0
1630 ndb_conflict_epoch_delete_delete_count
1631 0
1632 ndb_conflict_refresh_op_count
1633 1
1634 reflected_op_prepare_count_greater_than_zero
1635 1
1636 any_reflected_ops_applied
1637 0
1638 last_conflict_epoch_increased
1639 1
1640 conflict_handling_in_progess
1641 0
1642 stable_epoch_is_older_than_max_replicated
1643 0
1644 Now allow sync...
1645 START SLAVE;
1646 Warnings:
1647 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
1648 Allowing the sync should have allowed the second update
1649 (To 'Paddling') to be reflected, and rejected
1650 Data on Secondary (should be unchanged)
1651 select * from test.t1 order by k;
1652 k v c
1653 1 10 Paddling
1654 2 20 Cycling
1655 3 31 Judo
1656 4 440 Fell running
1657 Conflict counts on Secondary (incremented preped + rejected)
1658 Conflict algorithm counter diff :
1659 ndb_conflict_fn_epoch2
1660 0
1661 ndb_conflict_fn_epoch2_trans
1662 0
1663 ndb_conflict_trans_reject_count
1664 0
1665 ndb_conflict_epoch_delete_delete_count
1666 0
1667 ndb_conflict_refresh_op_count
1668 1
1669 reflected_op_prepare_count_greater_than_zero
1670 1
1671 any_reflected_ops_applied
1672 0
1673 last_conflict_epoch_increased
1674 1
1675 conflict_handling_in_progess
1676 0
1677 stable_epoch_is_older_than_max_replicated
1678 0
1679 Show same for DELETE
1680 --------------------
1681 First stop SLAVEs
1682 STOP SLAVE;
1683 Warnings:
1684 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
1685 STOP SLAVE;
1686 Warnings:
1687 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
1688 Now perform DELETE of row 2 at Secondary
1689 DELETE from test.t1 where k=2;
1690 Show data on Secondary
1691 select * from test.t1 order by k;
1692 k v c
1693 1 10 Paddling
1694 3 31 Judo
1695 4 440 Fell running
1696 Data on Primary
1697 select * from test.t1 order by k;
1698 k v c
1699 1 10 Paddling
1700 2 20 Cycling
1701 3 31 Judo
1702 4 440 Fell running
1703 Now propagate to Primary...
1704 START SLAVE;
1705 Warnings:
1706 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
1707 Updated data on Primary
1708 select * from test.t1 order by k;
1709 k v c
1710 1 10 Paddling
1711 3 31 Judo
1712 4 440 Fell running
1713 Now stop Primary slave to stop further propagation
1714 STOP SLAVE;
1715 Warnings:
1716 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
1717 Now make a further change on Secondary
1718 INSERT into test.t1 VALUES (2, 22, "Rock-climbing");
1719 Data on Secondary
1720 select * from test.t1 order by k;
1721 k v c
1722 1 10 Paddling
1723 2 22 Rock-climbing
1724 3 31 Judo
1725 4 440 Fell running
1726 Now allow Primary binlog, containing reflected delete op
1727 on row 2 to be applied it should be rejected by the
1728 Secondary, and increment the defined + rejected counts
1729 START SLAVE;
1730 Warnings:
1731 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
1732 Data on Secondary (should be unchanged)
1733 select * from test.t1 order by k;
1734 k v c
1735 1 10 Paddling
1736 2 22 Rock-climbing
1737 3 31 Judo
1738 4 440 Fell running
1739 Conflict counts on Secondary (incremented preped + rejected)
1740 Conflict algorithm counter diff :
1741 ndb_conflict_fn_epoch2
1742 0
1743 ndb_conflict_fn_epoch2_trans
1744 0
1745 ndb_conflict_trans_reject_count
1746 0
1747 ndb_conflict_epoch_delete_delete_count
1748 0
1749 ndb_conflict_refresh_op_count
1750 0
1751 reflected_op_prepare_count_greater_than_zero
1752 1
1753 any_reflected_ops_applied
1754 0
1755 last_conflict_epoch_increased
1756 0
1757 conflict_handling_in_progess
1758 0
1759 stable_epoch_is_older_than_max_replicated
1760 0
1761 Now allow sync...
1762 START SLAVE;
1763 Warnings:
1764 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
1765 Allowing the sync should have allowed the insert
1766 (To 'Rock-climbing') to be reflected, and rejected
1767 Data on Secondary (should be unchanged)
1768 select * from test.t1 order by k;
1769 k v c
1770 1 10 Paddling
1771 2 22 Rock-climbing
1772 3 31 Judo
1773 4 440 Fell running
1774 Conflict counts on Secondary (incremented preped + rejected)
1775 Conflict algorithm counter diff :
1776 ndb_conflict_fn_epoch2
1777 0
1778 ndb_conflict_fn_epoch2_trans
1779 0
1780 ndb_conflict_trans_reject_count
1781 0
1782 ndb_conflict_epoch_delete_delete_count
1783 0
1784 ndb_conflict_refresh_op_count
1785 0
1786 reflected_op_prepare_count_greater_than_zero
1787 1
1788 any_reflected_ops_applied
1789 0
1790 last_conflict_epoch_increased
1791 0
1792 conflict_handling_in_progess
1793 0
1794 stable_epoch_is_older_than_max_replicated
1795 0
1796 Primary insert-delete obscures Secondary insert problem
1797 -------------------------------------------------------
1798 Stop slaves in both directions
1799 STOP SLAVE;
1800 Warnings:
1801 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
1802 STOP SLAVE;
1803 Warnings:
1804 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
1805 Start with non-existent row (5, 50, "Disco dancing") on primary
1806 insert into test.t1 values (5, 50, "Disco dancing");
1807 select * from test.t1 order by k;
1808 k v c
1809 1 10 Paddling
1810 2 22 Rock-climbing
1811 3 31 Judo
1812 4 440 Fell running
1813 5 50 Disco dancing
1814 Reset conflict counters on Primary
1815 Empty exceptions table on Primary
1816 DELETE from test.t1$EX;
1817 Insert non-existent row (5, 500, "Line dancing") on secondary
1818 insert into test.t1 values (5, 500, "Line dancing");
1819 select * from test.t1 order by k;
1820 k v c
1821 1 10 Paddling
1822 2 22 Rock-climbing
1823 3 31 Judo
1824 4 440 Fell running
1825 5 500 Line dancing
1826 Reset conflict counters on Secondary
1827 Allow Primary insert to trample Secondary insert.
1828 START SLAVE;
1829 Warnings:
1830 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
1831 select * from test.t1 order by k;
1832 k v c
1833 1 10 Paddling
1834 2 22 Rock-climbing
1835 3 31 Judo
1836 4 440 Fell running
1837 5 50 Disco dancing
1838 Secondary now updates the row set by the Primary
1839 update test.t1 set v=v+5 where k=5;
1840 select * from test.t1 order by k;
1841 k v c
1842 1 10 Paddling
1843 2 22 Rock-climbing
1844 3 31 Judo
1845 4 440 Fell running
1846 5 55 Disco dancing
1847 Stop Secondary Slave again
1848 STOP SLAVE;
1849 Warnings:
1850 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
1851 Now delete row from the primary
1852 delete from test.t1 where k=5;
1853 select * from test.t1 order by k;
1854 k v c
1855 1 10 Paddling
1856 2 22 Rock-climbing
1857 3 31 Judo
1858 4 440 Fell running
1859 Now allow Secondary writes to propagate to Primary
1860 START SLAVE;
1861 Warnings:
1862 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
1863 Expect that the Secondary insert succeeded as no row existed
1864 on arrival, but then the secondary row was trampled by the
1865 primary, and then a secondary update was applied...
1866 So what do we see at the Primary?
1867 select * from test.t1 order by k;
1868 k v c
1869 1 10 Paddling
1870 2 22 Rock-climbing
1871 3 31 Judo
1872 4 440 Fell running
1873 5 55 Disco dancing
1874 Show primary conflict info counter diff - expect nothing.
1875 Conflict algorithm counter diff :
1876 ndb_conflict_fn_epoch2
1877 0
1878 ndb_conflict_fn_epoch2_trans
1879 0
1880 ndb_conflict_trans_reject_count
1881 0
1882 ndb_conflict_epoch_delete_delete_count
1883 0
1884 ndb_conflict_refresh_op_count
1885 0
1886 reflected_op_prepare_count_greater_than_zero
1887 0
1888 any_reflected_ops_applied
1889 0
1890 last_conflict_epoch_increased
1891 0
1892 conflict_handling_in_progess
1893 0
1894 stable_epoch_is_older_than_max_replicated
1895 0
1896 Show primary's exceptions table content - expect there to be none.
1897 SELECT k, v$old, v$new, c$old, c$new, ndb$op_type, ndb$cft_cause from test.t1$EX order by ndb$count;
1898 k v$old v$new c$old c$new ndb$op_type ndb$cft_cause
1899 Now allow Primary changes to propagate back to Secondary
1900 START SLAVE;
1901 Warnings:
1902 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
1903 Look at Secondary content
1904 select * from test.t1 order by k;
1905 k v c
1906 1 10 Paddling
1907 2 22 Rock-climbing
1908 3 31 Judo
1909 4 440 Fell running
1910 5 55 Disco dancing
1911 Look at Secondary conflict counters diff - showing
1912 reflected ops applied on Secondary
1913 Conflict algorithm counter diff :
1914 ndb_conflict_fn_epoch2
1915 0
1916 ndb_conflict_fn_epoch2_trans
1917 0
1918 ndb_conflict_trans_reject_count
1919 0
1920 ndb_conflict_epoch_delete_delete_count
1921 0
1922 ndb_conflict_refresh_op_count
1923 0
1924 reflected_op_prepare_count_greater_than_zero
1925 1
1926 any_reflected_ops_applied
1927 1
1928 last_conflict_epoch_increased
1929 1
1930 conflict_handling_in_progess
1931 1
1932 stable_epoch_is_older_than_max_replicated
1933 1
1934 select * from test.t1 order by k;
1935 k v c
1936 1 10 Paddling
1937 2 22 Rock-climbing
1938 3 31 Judo
1939 4 440 Fell running
1940 5 55 Disco dancing
1941 Iteration 1
1942 STOP SLAVE;
1943 Warnings:
1944 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
1945 DELETE FROM test.t1$EX;
1946 set global ndb_applier_conflict_role="SECONDARY";
1947 STOP SLAVE;
1948 Warnings:
1949 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
1950 DELETE FROM test.t1$EX;
1951 set global ndb_applier_conflict_role="PRIMARY";
1952 Setup S1 P2
1953 delete from test.t1;
1954 insert into test.t1 values
1955 (1,10, "Swimming"),
1956 (2,20, "Cycling"),
1957 (3,30, "Running"),
1958 (4,40, "Triathlon");
1959 START SLAVE;
1960 Warnings:
1961 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
1962 START SLAVE;
1963 Warnings:
1964 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
1965 Content on PRIMARY
1966 select * from test.t1 order by k;
1967 k v c
1968 1 10 Swimming
1969 2 20 Cycling
1970 3 30 Running
1971 4 40 Triathlon
1972 Content on SECONDARY
1973 select * from test.t1 order by k;
1974 k v c
1975 1 10 Swimming
1976 2 20 Cycling
1977 3 30 Running
1978 4 40 Triathlon
1979 Basic delete-delete cases
1980 -------------------------
1981 Stop Slave on SECONDARY
1982 STOP SLAVE;
1983 Warnings:
1984 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
1985 Delete row 3 on PRIMARY
1986 delete from t1 where k=3;
1987 Delete row 3 on SECONDARY
1988 delete from t1 where k=3;
1989 Insert replacement row on SECONDARY
1990 This is likely to go in the same SECONDARY epoch transaction
1991 insert into t1 values (3,31, "Judo");
1992 Wait for SECONDARY change to apply on PRIMARY
1993 Expect it to apply correctly here as the PRIMARY
1994 has no track of its outstanding DELETE
1995
1996 PRIMARY content
1997 select * from test.t1 order by k;
1998 k v c
1999 1 10 Swimming
2000 2 20 Cycling
2001 3 31 Judo
2002 4 40 Triathlon
2003 PRIMARY counters
2004 Conflict algorithm counter diff :
2005 ndb_conflict_fn_epoch2
2006 1
2007 ndb_conflict_fn_epoch2_trans
2008 0
2009 ndb_conflict_trans_reject_count
2010 0
2011 ndb_conflict_epoch_delete_delete_count
2012 1
2013 ndb_conflict_refresh_op_count
2014 0
2015 reflected_op_prepare_count_greater_than_zero
2016 0
2017 any_reflected_ops_applied
2018 0
2019 last_conflict_epoch_increased
2020 1
2021 conflict_handling_in_progess
2022 1
2023 stable_epoch_is_older_than_max_replicated
2024 0
2025 Re-enable SECONDARY Slave, and check state there
2026 START SLAVE;
2027 Warnings:
2028 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
2029 SECONDARY content
2030 select * from test.t1 order by k;
2031 k v c
2032 1 10 Swimming
2033 2 20 Cycling
2034 3 31 Judo
2035 4 40 Triathlon
2036 SECONDARY counters
2037 Conflict algorithm counter diff :
2038 ndb_conflict_fn_epoch2
2039 0
2040 ndb_conflict_fn_epoch2_trans
2041 0
2042 ndb_conflict_trans_reject_count
2043 0
2044 ndb_conflict_epoch_delete_delete_count
2045 0
2046 ndb_conflict_refresh_op_count
2047 0
2048 reflected_op_prepare_count_greater_than_zero
2049 1
2050 any_reflected_ops_applied
2051 1
2052 last_conflict_epoch_increased
2053 1
2054 conflict_handling_in_progess
2055 1
2056 stable_epoch_is_older_than_max_replicated
2057 1
2058 Look at PRIMARY exceptions table content
2059 SELECT k, v$old, v$new, c$old, c$new, ndb$op_type, ndb$cft_cause from test.t1$EX order by ndb$count;
2060 k v$old v$new c$old c$new ndb$op_type ndb$cft_cause
2061 3 30 NULL Running NULL delete_row row_does_not_exist
2062 Now check behaviour of Secondary when reflected ops should not be applied
2063 -------------------------------------------------------------------------
2064 The interpreted program attached to reflected ops at the Secondary slave
2065 is intended to avoid an 'old' reflected op overwriting a 'new' locally
2066 inserted row value. The end result should still be the same (the new
2067 value will be applied later, but we should avoid having every modification
2068 made at the secondary applied twice with some time lag as that will cause
2069 chaos for Secondary applications)
2070 Stop Slave on SECONDARY
2071 STOP SLAVE;
2072 Warnings:
2073 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
2074 Stop Slave on PRIMARY
2075 STOP SLAVE;
2076 Warnings:
2077 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
2078 Delete row 4 on PRIMARY
2079 DELETE from test.t1 where k=4;
2080 Primary state
2081 select * from test.t1 order by k;
2082 k v c
2083 1 10 Swimming
2084 2 20 Cycling
2085 3 31 Judo
2086 Delete row 4 on SECONDARY
2087 DELETE from test.t1 where k=4;
2088 Follow with INSERT on SECONDARY
2089 INSERT into test.t1 values (4, 440, "Fell running");
2090 Secondary state :
2091 select * from test.t1 order by k;
2092 k v c
2093 1 10 Swimming
2094 2 20 Cycling
2095 3 31 Judo
2096 4 440 Fell running
2097 Allow Primary change to propagate to Secondary
2098 (Which will delete the new, updated row on the Secondary)
2099 START SLAVE;
2100 Warnings:
2101 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
2102 Examine data on the SECONDARY - row 4 deleted
2103 select * from test.t1 order by k;
2104 k v c
2105 1 10 Swimming
2106 2 20 Cycling
2107 3 31 Judo
2108 Now allow the SECONDARY Binlog to propagate back to the PRIMARY
2109 while blocking the return path...
2110 STOP SLAVE;
2111 Warnings:
2112 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
2113 START SLAVE;
2114 Warnings:
2115 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
2116 Examine data on the PRIMARY - row 4 exists
2117 as the PRIMARY's delete is not applied if present
2118 select * from test.t1 order by k;
2119 k v c
2120 1 10 Swimming
2121 2 20 Cycling
2122 3 31 Judo
2123 4 440 Fell running
2124 Now stop the PRIMARY Slave - changes from the
2125 SECONDARY cannot now reach the PRIMARY
2126 STOP SLAVE;
2127 Warnings:
2128 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
2129 Now go back to the SECONDARY and create a new
2130 row version
2131 First show there is no row 4 on the SECONDARY
2132 select * from test.t1 order by k;
2133 k v c
2134 1 10 Swimming
2135 2 20 Cycling
2136 3 31 Judo
2137 INSERT into test.t1 values (4, 4444, "Cyclo-cross");
2138 select * from test.t1 order by k;
2139 k v c
2140 1 10 Swimming
2141 2 20 Cycling
2142 3 31 Judo
2143 4 4444 Cyclo-cross
2144 Now allow the Binlog of the PRIMARY (containing the
2145 reflected DELETE + Insert (4, 440, "Fell running")
2146 to be applied locally
2147 The SECONDARY should reject this application
2148 START SLAVE;
2149 Warnings:
2150 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
2151 Examine data on the SECONDARY : Row 4 should be untouched
2152 (4, 4444, "Cyclo-cross").
2153 Insert will be rejected as row already exists.
2154 select * from test.t1 order by k;
2155 k v c
2156 1 10 Swimming
2157 2 20 Cycling
2158 3 31 Judo
2159 4 4444 Cyclo-cross
2160 Show operation counter diff on the SECONDARY
2161 Should show reflected op prepared + rejected.
2162 Should show equal, non-zero reflected op prep+reject counts
2163 Conflict algorithm counter diff :
2164 ndb_conflict_fn_epoch2
2165 0
2166 ndb_conflict_fn_epoch2_trans
2167 0
2168 ndb_conflict_trans_reject_count
2169 0
2170 ndb_conflict_epoch_delete_delete_count
2171 0
2172 ndb_conflict_refresh_op_count
2173 0
2174 reflected_op_prepare_count_greater_than_zero
2175 1
2176 any_reflected_ops_applied
2177 0
2178 last_conflict_epoch_increased
2179 0
2180 conflict_handling_in_progess
2181 0
2182 stable_epoch_is_older_than_max_replicated
2183 0
2184 Ok, now allow SECONDARY Binlog to propagate to Primary
2185 and realign it
2186 START SLAVE;
2187 Warnings:
2188 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
2189 Show data on PRIMARY
2190 select * from test.t1 order by k;
2191 k v c
2192 1 10 Swimming
2193 2 20 Cycling
2194 3 31 Judo
2195 4 440 Fell running
2196 Allow reflection back to the SECONDARY...
2197 Now show same for UPDATE, then DELETE
2198 -------------------------------------
2199 First stop SLAVEs
2200 STOP SLAVE;
2201 Warnings:
2202 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
2203 STOP SLAVE;
2204 Warnings:
2205 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
2206 Now perform UPDATE 1 at Secondary
2207 UPDATE test.t1 SET c="Bathing" where k=1;
2208 Show data on Secondary
2209 select * from test.t1 order by k;
2210 k v c
2211 1 10 Bathing
2212 2 20 Cycling
2213 3 31 Judo
2214 4 440 Fell running
2215 Data on Primary
2216 select * from test.t1 order by k;
2217 k v c
2218 1 10 Swimming
2219 2 20 Cycling
2220 3 31 Judo
2221 4 440 Fell running
2222 Now propagate to Primary...
2223 START SLAVE;
2224 Warnings:
2225 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
2226 Updated data on Primary
2227 select * from test.t1 order by k;
2228 k v c
2229 1 10 Bathing
2230 2 20 Cycling
2231 3 31 Judo
2232 4 440 Fell running
2233 Now stop Primary slave to stop further propagation
2234 STOP SLAVE;
2235 Warnings:
2236 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
2237 Now make update 2 on Secondary
2238 update test.t1 SET c="Paddling" where k=1;
2239 Data on Secondary
2240 select * from test.t1 order by k;
2241 k v c
2242 1 10 Paddling
2243 2 20 Cycling
2244 3 31 Judo
2245 4 440 Fell running
2246 Now allow Primary binlog, containing reflected update op
2247 setting column c of row 1 to "Bathing" to be applied
2248 it should be rejected by the Secondary, and increment
2249 the defined + rejected counts
2250 START SLAVE;
2251 Warnings:
2252 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
2253 Data on Secondary (should be unchanged)
2254 select * from test.t1 order by k;
2255 k v c
2256 1 10 Paddling
2257 2 20 Cycling
2258 3 31 Judo
2259 4 440 Fell running
2260 Conflict counts on Secondary (incremented preped + rejected)
2261 Conflict algorithm counter diff :
2262 ndb_conflict_fn_epoch2
2263 0
2264 ndb_conflict_fn_epoch2_trans
2265 0
2266 ndb_conflict_trans_reject_count
2267 0
2268 ndb_conflict_epoch_delete_delete_count
2269 0
2270 ndb_conflict_refresh_op_count
2271 1
2272 reflected_op_prepare_count_greater_than_zero
2273 1
2274 any_reflected_ops_applied
2275 0
2276 last_conflict_epoch_increased
2277 1
2278 conflict_handling_in_progess
2279 0
2280 stable_epoch_is_older_than_max_replicated
2281 0
2282 Now allow sync...
2283 START SLAVE;
2284 Warnings:
2285 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
2286 Allowing the sync should have allowed the second update
2287 (To 'Paddling') to be reflected, and rejected
2288 Data on Secondary (should be unchanged)
2289 select * from test.t1 order by k;
2290 k v c
2291 1 10 Paddling
2292 2 20 Cycling
2293 3 31 Judo
2294 4 440 Fell running
2295 Conflict counts on Secondary (incremented preped + rejected)
2296 Conflict algorithm counter diff :
2297 ndb_conflict_fn_epoch2
2298 0
2299 ndb_conflict_fn_epoch2_trans
2300 0
2301 ndb_conflict_trans_reject_count
2302 0
2303 ndb_conflict_epoch_delete_delete_count
2304 0
2305 ndb_conflict_refresh_op_count
2306 1
2307 reflected_op_prepare_count_greater_than_zero
2308 1
2309 any_reflected_ops_applied
2310 0
2311 last_conflict_epoch_increased
2312 1
2313 conflict_handling_in_progess
2314 0
2315 stable_epoch_is_older_than_max_replicated
2316 0
2317 Show same for DELETE
2318 --------------------
2319 First stop SLAVEs
2320 STOP SLAVE;
2321 Warnings:
2322 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
2323 STOP SLAVE;
2324 Warnings:
2325 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
2326 Now perform DELETE of row 2 at Secondary
2327 DELETE from test.t1 where k=2;
2328 Show data on Secondary
2329 select * from test.t1 order by k;
2330 k v c
2331 1 10 Paddling
2332 3 31 Judo
2333 4 440 Fell running
2334 Data on Primary
2335 select * from test.t1 order by k;
2336 k v c
2337 1 10 Paddling
2338 2 20 Cycling
2339 3 31 Judo
2340 4 440 Fell running
2341 Now propagate to Primary...
2342 START SLAVE;
2343 Warnings:
2344 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
2345 Updated data on Primary
2346 select * from test.t1 order by k;
2347 k v c
2348 1 10 Paddling
2349 3 31 Judo
2350 4 440 Fell running
2351 Now stop Primary slave to stop further propagation
2352 STOP SLAVE;
2353 Warnings:
2354 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
2355 Now make a further change on Secondary
2356 INSERT into test.t1 VALUES (2, 22, "Rock-climbing");
2357 Data on Secondary
2358 select * from test.t1 order by k;
2359 k v c
2360 1 10 Paddling
2361 2 22 Rock-climbing
2362 3 31 Judo
2363 4 440 Fell running
2364 Now allow Primary binlog, containing reflected delete op
2365 on row 2 to be applied it should be rejected by the
2366 Secondary, and increment the defined + rejected counts
2367 START SLAVE;
2368 Warnings:
2369 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
2370 Data on Secondary (should be unchanged)
2371 select * from test.t1 order by k;
2372 k v c
2373 1 10 Paddling
2374 2 22 Rock-climbing
2375 3 31 Judo
2376 4 440 Fell running
2377 Conflict counts on Secondary (incremented preped + rejected)
2378 Conflict algorithm counter diff :
2379 ndb_conflict_fn_epoch2
2380 0
2381 ndb_conflict_fn_epoch2_trans
2382 0
2383 ndb_conflict_trans_reject_count
2384 0
2385 ndb_conflict_epoch_delete_delete_count
2386 0
2387 ndb_conflict_refresh_op_count
2388 0
2389 reflected_op_prepare_count_greater_than_zero
2390 1
2391 any_reflected_ops_applied
2392 0
2393 last_conflict_epoch_increased
2394 0
2395 conflict_handling_in_progess
2396 0
2397 stable_epoch_is_older_than_max_replicated
2398 0
2399 Now allow sync...
2400 START SLAVE;
2401 Warnings:
2402 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
2403 Allowing the sync should have allowed the insert
2404 (To 'Rock-climbing') to be reflected, and rejected
2405 Data on Secondary (should be unchanged)
2406 select * from test.t1 order by k;
2407 k v c
2408 1 10 Paddling
2409 2 22 Rock-climbing
2410 3 31 Judo
2411 4 440 Fell running
2412 Conflict counts on Secondary (incremented preped + rejected)
2413 Conflict algorithm counter diff :
2414 ndb_conflict_fn_epoch2
2415 0
2416 ndb_conflict_fn_epoch2_trans
2417 0
2418 ndb_conflict_trans_reject_count
2419 0
2420 ndb_conflict_epoch_delete_delete_count
2421 0
2422 ndb_conflict_refresh_op_count
2423 0
2424 reflected_op_prepare_count_greater_than_zero
2425 1
2426 any_reflected_ops_applied
2427 0
2428 last_conflict_epoch_increased
2429 0
2430 conflict_handling_in_progess
2431 0
2432 stable_epoch_is_older_than_max_replicated
2433 0
2434 Primary insert-delete obscures Secondary insert problem
2435 -------------------------------------------------------
2436 Stop slaves in both directions
2437 STOP SLAVE;
2438 Warnings:
2439 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
2440 STOP SLAVE;
2441 Warnings:
2442 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
2443 Start with non-existent row (5, 50, "Disco dancing") on primary
2444 insert into test.t1 values (5, 50, "Disco dancing");
2445 select * from test.t1 order by k;
2446 k v c
2447 1 10 Paddling
2448 2 22 Rock-climbing
2449 3 31 Judo
2450 4 440 Fell running
2451 5 50 Disco dancing
2452 Reset conflict counters on Primary
2453 Empty exceptions table on Primary
2454 DELETE from test.t1$EX;
2455 Insert non-existent row (5, 500, "Line dancing") on secondary
2456 insert into test.t1 values (5, 500, "Line dancing");
2457 select * from test.t1 order by k;
2458 k v c
2459 1 10 Paddling
2460 2 22 Rock-climbing
2461 3 31 Judo
2462 4 440 Fell running
2463 5 500 Line dancing
2464 Reset conflict counters on Secondary
2465 Allow Primary insert to trample Secondary insert.
2466 START SLAVE;
2467 Warnings:
2468 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
2469 select * from test.t1 order by k;
2470 k v c
2471 1 10 Paddling
2472 2 22 Rock-climbing
2473 3 31 Judo
2474 4 440 Fell running
2475 5 50 Disco dancing
2476 Secondary now updates the row set by the Primary
2477 update test.t1 set v=v+5 where k=5;
2478 select * from test.t1 order by k;
2479 k v c
2480 1 10 Paddling
2481 2 22 Rock-climbing
2482 3 31 Judo
2483 4 440 Fell running
2484 5 55 Disco dancing
2485 Stop Secondary Slave again
2486 STOP SLAVE;
2487 Warnings:
2488 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
2489 Now delete row from the primary
2490 delete from test.t1 where k=5;
2491 select * from test.t1 order by k;
2492 k v c
2493 1 10 Paddling
2494 2 22 Rock-climbing
2495 3 31 Judo
2496 4 440 Fell running
2497 Now allow Secondary writes to propagate to Primary
2498 START SLAVE;
2499 Warnings:
2500 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
2501 Expect that the Secondary insert succeeded as no row existed
2502 on arrival, but then the secondary row was trampled by the
2503 primary, and then a secondary update was applied...
2504 So what do we see at the Primary?
2505 select * from test.t1 order by k;
2506 k v c
2507 1 10 Paddling
2508 2 22 Rock-climbing
2509 3 31 Judo
2510 4 440 Fell running
2511 5 55 Disco dancing
2512 Show primary conflict info counter diff - expect nothing.
2513 Conflict algorithm counter diff :
2514 ndb_conflict_fn_epoch2
2515 0
2516 ndb_conflict_fn_epoch2_trans
2517 0
2518 ndb_conflict_trans_reject_count
2519 0
2520 ndb_conflict_epoch_delete_delete_count
2521 0
2522 ndb_conflict_refresh_op_count
2523 0
2524 reflected_op_prepare_count_greater_than_zero
2525 0
2526 any_reflected_ops_applied
2527 0
2528 last_conflict_epoch_increased
2529 0
2530 conflict_handling_in_progess
2531 0
2532 stable_epoch_is_older_than_max_replicated
2533 0
2534 Show primary's exceptions table content - expect there to be none.
2535 SELECT k, v$old, v$new, c$old, c$new, ndb$op_type, ndb$cft_cause from test.t1$EX order by ndb$count;
2536 k v$old v$new c$old c$new ndb$op_type ndb$cft_cause
2537 Now allow Primary changes to propagate back to Secondary
2538 START SLAVE;
2539 Warnings:
2540 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
2541 Look at Secondary content
2542 select * from test.t1 order by k;
2543 k v c
2544 1 10 Paddling
2545 2 22 Rock-climbing
2546 3 31 Judo
2547 4 440 Fell running
2548 5 55 Disco dancing
2549 Look at Secondary conflict counters diff - showing
2550 reflected ops applied on Secondary
2551 Conflict algorithm counter diff :
2552 ndb_conflict_fn_epoch2
2553 0
2554 ndb_conflict_fn_epoch2_trans
2555 0
2556 ndb_conflict_trans_reject_count
2557 0
2558 ndb_conflict_epoch_delete_delete_count
2559 0
2560 ndb_conflict_refresh_op_count
2561 0
2562 reflected_op_prepare_count_greater_than_zero
2563 1
2564 any_reflected_ops_applied
2565 1
2566 last_conflict_epoch_increased
2567 1
2568 conflict_handling_in_progess
2569 1
2570 stable_epoch_is_older_than_max_replicated
2571 1
2572 select * from test.t1 order by k;
2573 k v c
2574 1 10 Paddling
2575 2 22 Rock-climbing
2576 3 31 Judo
2577 4 440 Fell running
2578 5 55 Disco dancing
2579 Now test SCR_PASS
2580 -----------------
2581 SCR_PASS is a slave conflict role which should act as a
2582 filterless pass-through of replication events, with no
2583 conflict detection etc. The idea is that it might be
2584 useful for failover situations etc.
2585 Here we test that it does not detect conflicts, and
2586 allows divergence etc.
2587 Lets set it up
2588 STOP SLAVE;
2589 Warnings:
2590 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
2591 set global ndb_applier_conflict_role="NONE";
2592 set global ndb_applier_conflict_role="PASS";
2593 START SLAVE;
2594 Warnings:
2595 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
2596 STOP SLAVE;
2597 Warnings:
2598 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
2599 set global ndb_applier_conflict_role="NONE";
2600 set global ndb_applier_conflict_role="PASS";
2601 START SLAVE;
2602 Warnings:
2603 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
2604 Initial data on Primary
2605 select * from test.t1 order by k;
2606 k v c
2607 1 10 Paddling
2608 2 22 Rock-climbing
2609 3 31 Judo
2610 4 440 Fell running
2611 5 55 Disco dancing
2612 Initial data on Secondary
2613 select * from test.t1 order by k;
2614 k v c
2615 1 10 Paddling
2616 2 22 Rock-climbing
2617 3 31 Judo
2618 4 440 Fell running
2619 5 55 Disco dancing
2620 STOP SLAVE on Secondary
2621 STOP SLAVE;
2622 Warnings:
2623 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
2624 Create a conflict between two updates
2625 First at the primary
2626 update test.t1 set c="Capoiera" where c="Judo";
2627 select * from test.t1 order by k;
2628 k v c
2629 1 10 Paddling
2630 2 22 Rock-climbing
2631 3 31 Capoiera
2632 4 440 Fell running
2633 5 55 Disco dancing
2634 Now at the secondary
2635 update test.t1 set c="Wing chun" where c="Judo";
2636 select * from test.t1 order by k;
2637 k v c
2638 1 10 Paddling
2639 2 22 Rock-climbing
2640 3 31 Wing chun
2641 4 440 Fell running
2642 5 55 Disco dancing
2643 Now restart the secondary slave and allow propagation
2644 START SLAVE;
2645 Warnings:
2646 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
2647 Synchronise
2648 Now look at primary content and conflict counters
2649 select * from test.t1 order by k;
2650 k v c
2651 1 10 Paddling
2652 2 22 Rock-climbing
2653 3 31 Wing chun
2654 4 440 Fell running
2655 5 55 Disco dancing
2656 Conflict algorithm counter diff :
2657 ndb_conflict_fn_epoch2
2658 0
2659 ndb_conflict_fn_epoch2_trans
2660 0
2661 ndb_conflict_trans_reject_count
2662 0
2663 ndb_conflict_epoch_delete_delete_count
2664 0
2665 ndb_conflict_refresh_op_count
2666 0
2667 reflected_op_prepare_count_greater_than_zero
2668 0
2669 any_reflected_ops_applied
2670 0
2671 last_conflict_epoch_increased
2672 0
2673 conflict_handling_in_progess
2674 0
2675 stable_epoch_is_older_than_max_replicated
2676 0
2677 Now look at secondary content and conflict counters
2678 select * from test.t1 order by k;
2679 k v c
2680 1 10 Paddling
2681 2 22 Rock-climbing
2682 3 31 Capoiera
2683 4 440 Fell running
2684 5 55 Disco dancing
2685 Conflict algorithm counter diff :
2686 ndb_conflict_fn_epoch2
2687 0
2688 ndb_conflict_fn_epoch2_trans
2689 0
2690 ndb_conflict_trans_reject_count
2691 0
2692 ndb_conflict_epoch_delete_delete_count
2693 0
2694 ndb_conflict_refresh_op_count
2695 0
2696 reflected_op_prepare_count_greater_than_zero
2697 0
2698 any_reflected_ops_applied
2699 0
2700 last_conflict_epoch_increased
2701 0
2702 conflict_handling_in_progess
2703 0
2704 stable_epoch_is_older_than_max_replicated
2705 0
2706 Now look at how row existence errors are handled
2707 PRIMARY
2708 insert into test.t1 values (6, 60, "Cigars");
2709 insert into test.t1 values (7, 70, "Whisky");
2710 Synchronise
2711 Cause misalignment via 'secret' deletes.
2712 PRIMARY
2713 set sql_log_bin=0;
2714 delete from test.t1 where k=7;
2715 set sql_log_bin=1;
2716 SECONDARY
2717 set sql_log_bin=0;
2718 delete from test.t1 where k=6;
2719 set sql_log_bin=1;
2720 Synchronise
2721 Show start state
2722 Primary :
2723 select * from test.t1 order by k;
2724 k v c
2725 1 10 Paddling
2726 2 22 Rock-climbing
2727 3 31 Wing chun
2728 4 440 Fell running
2729 5 55 Disco dancing
2730 6 60 Cigars
2731 Secondary :
2732 select * from test.t1 order by k;
2733 k v c
2734 1 10 Paddling
2735 2 22 Rock-climbing
2736 3 31 Capoiera
2737 4 440 Fell running
2738 5 55 Disco dancing
2739 7 70 Whisky
2740 Now insert a row on the Secondary which already
2741 exists on the Primary
2742 insert into test.t1 values (6,66, "Snuff");
2743 select * from test.t1 order by k;
2744 k v c
2745 1 10 Paddling
2746 2 22 Rock-climbing
2747 3 31 Capoiera
2748 4 440 Fell running
2749 5 55 Disco dancing
2750 6 66 Snuff
2751 7 70 Whisky
2752 Show that the primary was overwritten with the Secondary's
2753 value, and no conflict reported.
2754 select * from test.t1 order by k;
2755 k v c
2756 1 10 Paddling
2757 2 22 Rock-climbing
2758 3 31 Wing chun
2759 4 440 Fell running
2760 5 55 Disco dancing
2761 6 66 Snuff
2762 Conflict algorithm counter diff :
2763 ndb_conflict_fn_epoch2
2764 0
2765 ndb_conflict_fn_epoch2_trans
2766 0
2767 ndb_conflict_trans_reject_count
2768 0
2769 ndb_conflict_epoch_delete_delete_count
2770 0
2771 ndb_conflict_refresh_op_count
2772 0
2773 reflected_op_prepare_count_greater_than_zero
2774 0
2775 any_reflected_ops_applied
2776 0
2777 last_conflict_epoch_increased
2778 0
2779 conflict_handling_in_progess
2780 0
2781 stable_epoch_is_older_than_max_replicated
2782 0
2783 Same for a Secondary sourced update of a row
2784 which doesn't exist on the primary.
2785 update test.t1 set c="Tawny Port" where c="Whisky";
2786 select * from test.t1 order by k;
2787 k v c
2788 1 10 Paddling
2789 2 22 Rock-climbing
2790 3 31 Capoiera
2791 4 440 Fell running
2792 5 55 Disco dancing
2793 6 66 Snuff
2794 7 70 Tawny Port
2795 Show state on Primary. No row, but also no conflicts
2796 or slave errors.
2797 select * from test.t1 order by k;
2798 k v c
2799 1 10 Paddling
2800 2 22 Rock-climbing
2801 3 31 Wing chun
2802 4 440 Fell running
2803 5 55 Disco dancing
2804 6 66 Snuff
2805 Conflict algorithm counter diff :
2806 ndb_conflict_fn_epoch2
2807 0
2808 ndb_conflict_fn_epoch2_trans
2809 0
2810 ndb_conflict_trans_reject_count
2811 0
2812 ndb_conflict_epoch_delete_delete_count
2813 0
2814 ndb_conflict_refresh_op_count
2815 0
2816 reflected_op_prepare_count_greater_than_zero
2817 0
2818 any_reflected_ops_applied
2819 0
2820 last_conflict_epoch_increased
2821 0
2822 conflict_handling_in_progess
2823 0
2824 stable_epoch_is_older_than_max_replicated
2825 0
2826 Now show a row delete from the secondary for
2827 a row which does not exist on the primary
2828 delete from test.t1 where k=7;
2829 select * from test.t1 order by k;
2830 k v c
2831 1 10 Paddling
2832 2 22 Rock-climbing
2833 3 31 Capoiera
2834 4 440 Fell running
2835 5 55 Disco dancing
2836 6 66 Snuff
2837 Show state on Primary. No conflicts or slave errors
2838 select * from test.t1 order by k;
2839 k v c
2840 1 10 Paddling
2841 2 22 Rock-climbing
2842 3 31 Wing chun
2843 4 440 Fell running
2844 5 55 Disco dancing
2845 6 66 Snuff
2846 Conflict algorithm counter diff :
2847 ndb_conflict_fn_epoch2
2848 0
2849 ndb_conflict_fn_epoch2_trans
2850 0
2851 ndb_conflict_trans_reject_count
2852 0
2853 ndb_conflict_epoch_delete_delete_count
2854 0
2855 ndb_conflict_refresh_op_count
2856 0
2857 reflected_op_prepare_count_greater_than_zero
2858 0
2859 any_reflected_ops_applied
2860 0
2861 last_conflict_epoch_increased
2862 0
2863 conflict_handling_in_progess
2864 0
2865 stable_epoch_is_older_than_max_replicated
2866 0
2867 Remove inconsistencies from the table
2868 delete from test.t1 where k in (3, 6);
2869 STOP SLAVE;
2870 Warnings:
2871 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
2872 set global ndb_applier_conflict_role="NONE";
2873 set global ndb_applier_conflict_role="PRIMARY";
2874 START SLAVE;
2875 Warnings:
2876 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
2877 STOP SLAVE;
2878 Warnings:
2879 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
2880 set global ndb_applier_conflict_role="NONE";
2881 set global ndb_applier_conflict_role="SECONDARY";
2882 START SLAVE;
2883 Warnings:
2884 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
2885 Test ndb_conflict_last_stable_epoch
2886 This status var is intended to help in situations
2887 where there is an unexpected PRIMARY failure, and
2888 the SECONDARY can determine that there were in-flight
2889 realignment ops (conflicts), based on
2890 ndb_conflict_last_conflict_epoch >
2891 ndb_slave_max_replicated_epoch
2892 ndb_conflict_last_stable_epoch will contain the
2893 last (highest) SECONDARY epoch which is known
2894 to have replicated via the PRIMARY with no
2895 conflicts being discovered. This is then
2896 a consistent baseline from which to potentially
2897 resolve any partial realignments.
2898 How to resolve them is an exercise left for
2899 the reader :)
2900 Testcase to show the variable in action
2901 Stop SECONDARY slave
2902 STOP SLAVE;
2903 Warnings:
2904 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
2905 Change on Primary, won't propagate to Secondary as SLAVE is stopped.
2906 update test.t1 set c="Loafing" where k=1;
2907 Conflicting change on Secondary
2908 update test.t1 set c="Idling" where k=1;
2909 Add some epochs after the conflicting modification
2910 insert into t1 values (10 + 10, 10, "Sequencing");
2911 insert into t1 values (9 + 10, 10, "Sequencing");
2912 insert into t1 values (8 + 10, 10, "Sequencing");
2913 insert into t1 values (7 + 10, 10, "Sequencing");
2914 insert into t1 values (6 + 10, 10, "Sequencing");
2915 insert into t1 values (5 + 10, 10, "Sequencing");
2916 insert into t1 values (4 + 10, 10, "Sequencing");
2917 insert into t1 values (3 + 10, 10, "Sequencing");
2918 insert into t1 values (2 + 10, 10, "Sequencing");
2919 insert into t1 values (1 + 10, 10, "Sequencing");
2920 Now look at Secondary values, should have
2921 Max_Replicated_Epoch == Last_Stable_Epoch
2922 Expect 1,0,1 - all is well.
2923 SELECT (@ndb_last_conflict_epoch+0) <= (@ndb_max_replicated_epoch+0) AS SECONDARY_IS_CURRENTLY_CONFLICT_FREE;
2924 SECONDARY_IS_CURRENTLY_CONFLICT_FREE
2925 1
2926 SELECT (@ndb_last_stable_epoch+0) < (@ndb_max_replicated_epoch+0) AS STABLE_EPOCH_LAGS_MAX_REPLICATED_EPOCH;
2927 STABLE_EPOCH_LAGS_MAX_REPLICATED_EPOCH
2928 0
2929 SELECT (@ndb_last_stable_epoch+0) = (@ndb_max_replicated_epoch+0) AS STABLE_EPOCH_IS_MAX_REPLICATED_EPOCH;
2930 STABLE_EPOCH_IS_MAX_REPLICATED_EPOCH
2931 1
2932 Stop PRIMARY slave just to have control
2933 STOP SLAVE;
2934 Warnings:
2935 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
2936 Conflict algorithm counter diff :
2937 ndb_conflict_fn_epoch2
2938 1
2939 ndb_conflict_fn_epoch2_trans
2940 0
2941 ndb_conflict_trans_reject_count
2942 0
2943 ndb_conflict_epoch_delete_delete_count
2944 0
2945 ndb_conflict_refresh_op_count
2946 0
2947 reflected_op_prepare_count_greater_than_zero
2948 0
2949 any_reflected_ops_applied
2950 0
2951 last_conflict_epoch_increased
2952 1
2953 conflict_handling_in_progess
2954 1
2955 stable_epoch_is_older_than_max_replicated
2956 0
2957 Now Start SECONDARY slave, to get conflict realignment
2958 and following SECONDARY epochs re-applied on the SEOCNDARY
2959 START SLAVE;
2960 Warnings:
2961 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
2962 Now look at variables on the SECONDARY again
2963 Expect 0,1,0 - Conflict handling open, stable epoch is old, most recent
2964 replicated epochs are not yet stable.
2965 SELECT (@ndb_last_conflict_epoch+0) <= (@ndb_max_replicated_epoch+0) AS SECONDARY_IS_CURRENTLY_CONFLICT_FREE;
2966 SECONDARY_IS_CURRENTLY_CONFLICT_FREE
2967 0
2968 SELECT (@ndb_last_stable_epoch+0) < (@ndb_max_replicated_epoch+0) AS STABLE_EPOCH_LAGS_MAX_REPLICATED_EPOCH;
2969 STABLE_EPOCH_LAGS_MAX_REPLICATED_EPOCH
2970 1
2971 SELECT (@ndb_last_stable_epoch+0) = (@ndb_max_replicated_epoch+0) AS STABLE_EPOCH_IS_MAX_REPLICATED_EPOCH;
2972 STABLE_EPOCH_IS_MAX_REPLICATED_EPOCH
2973 0
2974 Now make a SECONDARY change and allow it to flow
2975 START SLAVE;
2976 Warnings:
2977 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
2978 delete from test.t1 where k >=10;
2979 Now look at variables on the SECONDARY for third time
2980 Expect 1,0,1 - stability has returned
2981 SELECT (@ndb_last_conflict_epoch+0) <= (@ndb_max_replicated_epoch+0) AS SECONDARY_IS_CURRENTLY_CONFLICT_FREE;
2982 SECONDARY_IS_CURRENTLY_CONFLICT_FREE
2983 1
2984 SELECT (@ndb_last_stable_epoch+0) < (@ndb_max_replicated_epoch+0) AS STABLE_EPOCH_LAGS_MAX_REPLICATED_EPOCH;
2985 STABLE_EPOCH_LAGS_MAX_REPLICATED_EPOCH
2986 0
2987 SELECT (@ndb_last_stable_epoch+0) = (@ndb_max_replicated_epoch+0) AS STABLE_EPOCH_IS_MAX_REPLICATED_EPOCH;
2988 STABLE_EPOCH_IS_MAX_REPLICATED_EPOCH
2989 1
2990 Done.
2991 Cleanup conflict roles
2992 --------------------
2993 STOP SLAVE;
2994 Warnings:
2995 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
2996 set global ndb_applier_conflict_role="NONE";
2997 START SLAVE;
2998 Warnings:
2999 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
3000 STOP SLAVE;
3001 Warnings:
3002 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
3003 set global ndb_applier_conflict_role="NONE";
3004 START SLAVE;
3005 Warnings:
3006 Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead
3007 stop slave;
3008 Warnings:
3009 Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead
3010 reset slave;
3011 Warnings:
3012 Warning 1287 'RESET SLAVE' is deprecated and will be removed in a future release. Please use RESET REPLICA instead
3013 drop table test.t1;
3014 drop table test.t1$EX;
3015 drop table mysql.ndb_replication;
3016 include/rpl_end.inc