Debian Codegraph @

mysql-test/suite/galera/t/MW-369.inc

raw
1 #
2 # This file should be included from tests for MW-369 to run concurrent
3 # transaction from node_1 with autocommit query from node_2.
4 #
5 # The parameters:
6 # * $mw_369_parent_query - the parent query to be run inside transaction
7 # * $mw_369_child_query - the child query
8 #
9 # The operations are the following:
10 #
11 # node_1:
12 # START TRANSACTION;
13 # $mw_369_parent_query
14 # node_2
15 # $mw_369_child_query - will be blocked on node_1 in wsrep_apply_cb
16 # node_1:
17 # COMMIT; - will be blocked on node_1 in after_wsrep_before_prepare
18 #
19 # The $mw_369_child_query is always expected to succeed. The caller is
20 # responsible for checking if the final COMMIT on connection node_1
21 # succeeds.
22 #
23
24 --connection node_1
25 SET AUTOCOMMIT=ON;
26 START TRANSACTION;
27 --eval $mw_369_parent_query
28
29 #
30 # Block the $mw_369_child_query from node_2
31 #
32 # --connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
33 --connection node_1a
34 SET SESSION wsrep_sync_wait = 0;
35 SET GLOBAL DEBUG_DBUG = "d,sync.wsrep_apply_cb";
36
37 #
38 # insert client row, which will make it impossible to replay the
39 # delete on parent
40 #
41 --connection node_2
42 --eval $mw_369_child_query
43
44 #
45 # Wait until $mw_369_child_query from node_2 reaches the sync point and
46 # block the 'COMMIT' from node_1 before it certifies.
47 #
48 --connection node_1a
49 SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached";
50
51 --connection node_1
52 SET SESSION DEBUG_SYNC = "wsrep_before_certification SIGNAL before_certification_reached WAIT_FOR continue_before_certification";
53 --send COMMIT
54
55 #
56 # Wait until both sync points have been reached
57 #
58 --connection node_1a
59 SET SESSION DEBUG_SYNC = "now WAIT_FOR before_certification_reached";
60
61 #
62 # both threads are now parked in sync points, signal them to continue
63 #
64
65 --let $wait_condition = SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'debug sync point:%'
66 --let $wait_condition_on_error_output = SELECT STATE FROM INFORMATION_SCHEMA.PROCESSLIST
67 --source include/wait_condition_with_debug.inc
68
69 SET SESSION DEBUG_SYNC = 'now SIGNAL continue_before_certification';
70
71 --let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'debug sync point:%'
72 --let $wait_condition_on_error_output = SELECT STATE FROM INFORMATION_SCHEMA.PROCESSLIST
73 --source include/wait_condition_with_debug.inc
74
75 SET SESSION DEBUG_SYNC = 'now SIGNAL signal.wsrep_apply_cb';
76
77 --let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'debug sync point:%'
78 --let $wait_condition_on_error_output = SELECT STATE FROM INFORMATION_SCHEMA.PROCESSLIST
79 --source include/wait_condition_with_debug.inc
80
81 SET GLOBAL DEBUG_DBUG = "";
82 SET DEBUG_SYNC = 'RESET';