summaryrefslogtreecommitdiff
path: root/mysql-test/suite/galera/t/MW-369.inc
blob: 71df979d6ba0d7a72e35ecf9a08a9f3d4e6c1b1c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#
# This file should be included from tests for MW-369 to run concurrent
# transaction from node_1 with autocommit query from node_2.
#
# The parameters:
# * $mw_369_parent_query - the parent query to be run inside transaction
# * $mw_369_child_query - the child query
#
# The operations are the following:
#
# node_1:
# START TRANSACTION;
# $mw_369_parent_query
# node_2
# $mw_369_child_query - will be blocked on node_1 in apply monitor
# node_1:
# COMMIT;             - will be blocked on node_1 in local monitor
#
# The $mw_369_child_query is always expected to succeed. The caller is
# responsible for checking if the final COMMIT on connection node_1
# succeeds.
#

--connection node_1
SET AUTOCOMMIT=ON;
START TRANSACTION;
--eval $mw_369_parent_query

#
# Block the $mw_369_child_query from node_2
#
# --connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
--connection node_1a
SET SESSION wsrep_sync_wait = 0;
--let $galera_sync_point = apply_monitor_slave_enter_sync
--source include/galera_set_sync_point.inc

#
# insert client row, which will make it impossible to replay the
# delete on parent
#
--connection node_2
--eval $mw_369_child_query

#
# Wait until $mw_369_child_query from node_2 reaches the sync point and
# block the 'COMMIT' from node_1 before it certifies.
#
--connection node_1a
--source include/galera_wait_sync_point.inc
--source include/galera_clear_sync_point.inc

--let $galera_sync_point = local_monitor_master_enter_sync
--source include/galera_set_sync_point.inc

--connection node_1
--send COMMIT

#
# Wait until both sync points have been reached
#
--connection node_1a
--let $galera_sync_point = apply_monitor_slave_enter_sync local_monitor_master_enter_sync
--source include/galera_wait_sync_point.inc

#
# both threads are now parked in sync points, signal them to continue
#
--let $galera_sync_point = apply_monitor_slave_enter_sync
--source include/galera_signal_sync_point.inc

--let $galera_sync_point = local_monitor_master_enter_sync
--source include/galera_signal_sync_point.inc
--source include/galera_clear_sync_point.inc