Debian Codegraph @

mysql-test/suite/galera/t/galera_bf_kill_debug.test

raw
1 --source include/galera_cluster.inc
2 --source include/have_innodb.inc
3 --source include/have_debug.inc
4 --source include/have_debug_sync.inc
5
6 #
7 # Test case 7:
8 # 1. Start a transaction on node_2,
9 # and leave it pending while holding a row locked
10 # 2. set sync point pause applier
11 # 3. send a conflicting write on node_1, it will pause
12 # at the sync point
13 # 4. though another connection to node_2, kill the local
14 # transaction
15 #
16
17 --connection node_2
18 CREATE TABLE t1(a int not null primary key auto_increment,b int) engine=InnoDB;
19 insert into t1 values (NULL,1);
20
21 #
22 # connection node_2a runs a local transaction, that is victim of BF abort
23 # and victim of KILL command by connection node_2
24 #
25 --connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
26 --connection node_2a
27 truncate t1;
28 insert into t1 values (1,0);
29
30 # start a transaction that will conflict with later applier
31 begin;
32 update t1 set b=2 where a=1;
33
34 --connection node_2
35 set session wsrep_sync_wait=0;
36 --let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'root' AND COMMAND = 'Sleep' LIMIT 1
37 --source include/wait_condition.inc
38
39 --let $k_thread = `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'root' AND COMMAND = 'Sleep' LIMIT 1`
40
41 # connection node_2b is for controlling debug syn points
42 # first set a sync point for applier, to pause during BF aborting
43 # and before THD::awake would be called
44 #
45 --connect node_2b, 127.0.0.1, root, , test, $NODE_MYPORT_2
46 --connection node_2b
47 SET GLOBAL debug_dbug = "d,sync.before_wsrep_thd_abort";
48
49 #
50 # replicate an update, which will BF abort the victim node_2a
51 # however, while applier in node 2 is handling the abort,
52 # it will pause in sync point set by node_2b
53 #
54 --connection node_1
55 select * from t1;
56 update t1 set b= 1 where a=1;
57
58 #
59 # wait until the applying of above update has reached the sync point
60 # in node 2
61 #
62 --connection node_2b
63 SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.before_wsrep_thd_abort_reached";
64
65 --connection node_2
66 #
67 # pause KILL execution before awake
68 #
69 SET DEBUG_SYNC= 'wsrep_kill_before_awake_no_mutex SIGNAL awake_reached WAIT_FOR continue_kill';
70 --disable_query_log
71 --send_eval KILL $k_thread
72 --enable_query_log
73
74
75 --connection node_2b
76 SET DEBUG_SYNC='now WAIT_FOR awake_reached';
77
78 # release applier and KILL operator
79 SET GLOBAL debug_dbug = "";
80 SET DEBUG_SYNC = "now SIGNAL signal.before_wsrep_thd_abort";
81
82 --connection node_1
83 COMMIT;
84
85 --connection node_2b
86 SET DEBUG_SYNC = "now SIGNAL continue_kill";
87
88 --connection node_2
89 --reap
90
91 --connection node_2a
92 --error 0,1213,2013,2026
93 select * from t1;
94
95 --connection node_2b
96 SET DEBUG_SYNC = "RESET";
97
98 drop table t1;
99
100 --disconnect node_2a
101 #
102 # Test case 7:
103 # run a transaction in node 2, and set a sync point to pause the transaction
104 # in commit phase.
105 # Through another connection to node 2, kill the committing transaction by
106 # KILL QUERY command
107 #
108
109 --connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
110 --connection node_2a
111 --let $connection_id = `SELECT CONNECTION_ID()`
112
113 CREATE TABLE t1 (i int primary key) engine=innodb;
114
115 # Set up sync point
116 SET DEBUG_SYNC = "before_wsrep_ordered_commit SIGNAL bwoc_reached WAIT_FOR bwoc_continue";
117
118 # Send insert which will block in the sync point above
119 --send INSERT INTO t1 VALUES (1)
120
121 --connection node_2
122 SET DEBUG_SYNC = "now WAIT_FOR bwoc_reached";
123
124 --disable_query_log
125 --disable_result_log
126 # victim has passed the point of no return, kill is not possible anymore
127 --eval KILL QUERY $connection_id
128 --enable_result_log
129 --enable_query_log
130
131 SET DEBUG_SYNC = "now SIGNAL bwoc_continue";
132 --connection node_2a
133 --error 0,1213,2013,2026
134 --reap
135
136 --connection node_2
137 SET DEBUG_SYNC='RESET';
138 # victim was able to complete the INSERT
139 select * from t1;
140
141 --disconnect node_2a
142 --disconnect node_2b
143
144 --connection node_1
145 drop table t1;