Debian Codegraph @

mysql-test/suite/galera/t/MDEV-20793.test

raw
1 #
2 # MDEV-20793 Assertion after certification failure during replay.
3 #
4 # The test outline:
5 # In order to produce certification failure three transactions
6 # are needed. One transaction is executing on node_1 and two others
7 # on node_2. The first transaction from node_2 BF aborts the transaction
8 # on node_1, but does not cause certification conflict. The second
9 # transaction from node_2 will cause conflict and the transaction on
10 # node_1 fails in certification during replay.
11 #
12
13 --source include/galera_cluster.inc
14 --source include/have_debug.inc
15 --source include/have_debug_sync.inc
16 --source include/galera_have_debug_sync.inc
17
18 CREATE TABLE t1 (f1 INT PRIMARY KEY, f2 INT);
19 INSERT INTO t1 VALUES (1, 0), (5, 0);
20
21 --let galera_connection_name = node_1_ctrl
22 --let galera_server_number = 1
23 --source include/galera_connect.inc
24 --connection node_1_ctrl
25 SET SESSION wsrep_sync_wait = 0;
26 SET GLOBAL wsrep_slave_threads = 2;
27
28 --connection node_1
29 # Start transaction which takes gap lock 1 - 5
30 SET SESSION wsrep_retry_autocommit = 0;
31 START TRANSACTION;
32 UPDATE t1 SET f2 = 1;
33
34 --connection node_1_ctrl
35 # set sync point for incoming applier
36 --let $galera_sync_point = apply_monitor_slave_enter_sync
37 --source include/galera_set_sync_point.inc
38
39 --connection node_2
40 # Insert into gap from other node. This generates BF abort but does not
41 # conflict with update.
42 INSERT INTO t1 VALUES (2, 2);
43
44 --connection node_1_ctrl
45 # wait to see the INSERT from node_2 reaching applier sync point
46 --source include/galera_wait_sync_point.inc
47 --source include/galera_clear_sync_point.inc
48
49 # set sync point to catch other write set applying from node_2
50 --let $galera_sync_point = local_monitor_slave_enter_sync
51 --source include/galera_set_sync_point.inc
52
53 # Make an update which will conflict with update on node_1
54 --connection node_2
55 UPDATE t1 SET f2 = 2 WHERE f1 = 5;
56
57 --connection node_1_ctrl
58 # wait until both appliers are stopped in sync points
59 --let $galera_sync_point = apply_monitor_slave_enter_sync local_monitor_slave_enter_sync
60 --source include/galera_wait_sync_point.inc
61 --source include/galera_clear_sync_point.inc
62
63 # set sync point for catching node_1 transaction just before committing
64 --let $galera_sync_point = after_replicate_sync
65 --source include/galera_set_sync_point.inc
66
67 --connection node_1
68 # set sync point, which will stop execution after COMMIT has been BF aborted
69 # and send the COMMIT, it should stop in commit_monitor_master_enter_sync point
70 SET SESSION debug_sync = "wsrep_before_replay SIGNAL reached WAIT_FOR continue";
71 --send COMMIT
72
73 --connection node_1_ctrl
74 # wait until both appliers and local COMMIT are idle in their sync points
75 --let $galera_sync_point = after_replicate_sync apply_monitor_slave_enter_sync local_monitor_slave_enter_sync
76 --source include/galera_wait_sync_point.inc
77
78 # release local COMMIT processing, it will continue and pause first before certification,
79 --let $galera_sync_point = after_replicate_sync
80 --source include/galera_signal_sync_point.inc
81
82 # release first applier (INSERT), it should BF abort the local COMMIT processing
83 --let $galera_sync_point = apply_monitor_slave_enter_sync
84 --source include/galera_signal_sync_point.inc
85
86 # wait to see that COMMIT was BF aborted and has reached replaying state
87 SET SESSION debug_sync = "now WAIT_FOR reached";
88
89 # release the latter applier, with real lock conflict
90 --let $galera_sync_point = local_monitor_slave_enter_sync
91 --source include/galera_signal_sync_point.inc
92 --source include/galera_clear_sync_point.inc
93 SET SESSION debug_sync = "now SIGNAL continue";
94
95 --connection node_1
96 --error ER_LOCK_DEADLOCK
97 --reap
98
99 SET debug_sync = "RESET";
100
101 DROP TABLE t1;
102 SET GLOBAL wsrep_slave_threads = DEFAULT;