Debian Codegraph @

mysql-test/suite/group_replication/t/gr_consistent_reads_after_parallel_stop.test

raw
1 ################################################################################
2 # Validate group_replication_consistency= 'AFTER' behaviour when executed
3 # concurrently with STOP GROUP_REPLICATION.
4 #
5 # Test:
6 # 00. The test requires two servers: M1 and M2.
7 # 01. Create two tables on the group.
8 # 02. Force server2 to block between T1 prepare and commit.
9 # 03. Execute transaction T1.
10 # 04. Wait for server2 to block between T1 prepare and commit.
11 # 05. Stop the plugin on server2.
12 # 06. Execute transaction T2, it will not be allowed to
13 # execute since plugin is stopping, otherwise there may
14 # be a deadlock on the waiting conditions.
15 # 07. Unblock T1 prepare on server2.
16 # 08. Resume the plugin stop.
17 # 09. Resume transaction T1.
18 # 10. Clean up.
19 ################################################################################
20 --source include/have_debug_sync.inc
21 --source include/have_group_replication_plugin.inc
22 --source include/group_replication.inc
23
24 --echo
25 --echo ############################################################
26 --echo # 01. Create two tables on the group.
27 --let $rpl_connection_name= server1
28 --source include/rpl_connection.inc
29 SET @@SESSION.group_replication_consistency= 'AFTER';
30 CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY);
31 CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY);
32
33
34 --echo
35 --echo ############################################################
36 --echo # 02. Force server2 to block between T1 prepare and commit.
37 --let $rpl_connection_name= server_2_1
38 --source include/rpl_connection.inc
39 SET @@GLOBAL.DEBUG= '+d,group_replication_wait_on_after_applier_prepare';
40
41
42 --echo
43 --echo ############################################################
44 --echo # 03. Execute transaction T1.
45 --let $rpl_connection_name= server1
46 --source include/rpl_connection.inc
47 BEGIN;
48 INSERT INTO t1 VALUES (1);
49 INSERT INTO t2 VALUES (1);
50 --send COMMIT
51
52
53 --echo
54 --echo ############################################################
55 --echo # 04. Wait for server2 to block between T1 prepare and commit.
56 --let $rpl_connection_name= server_2_1
57 --source include/rpl_connection.inc
58 SET DEBUG_SYNC= "now WAIT_FOR signal.after_applier_prepare_waiting";
59
60
61 --echo
62 --echo ############################################################
63 --echo # 05. Stop the plugin on server2.
64 --let $rpl_connection_name= server_2_1
65 --source include/rpl_connection.inc
66 SET @@GLOBAL.DEBUG= '+d,group_replication_hold_stop_before_leave_the_group';
67 --send STOP GROUP_REPLICATION
68
69 --let $rpl_connection_name= server2
70 --source include/rpl_connection.inc
71 --let $wait_condition=SELECT COUNT(*)=1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE State='debug sync point: now' AND Info='STOP GROUP_REPLICATION'
72 --source include/wait_condition.inc
73
74
75 --echo
76 --echo ############################################################
77 --echo # 06. Execute transaction T2, it will not be allowed to
78 --echo # execute since plugin is stopping, otherwise there may
79 --echo # be a deadlock on the waiting conditions.
80 --let $rpl_connection_name= server2
81 --source include/rpl_connection.inc
82 --error ER_GRP_TRX_CONSISTENCY_BEGIN_NOT_ALLOWED
83 SELECT * FROM t1;
84
85
86 --echo
87 --echo ############################################################
88 --echo # 07. Unblock T1 prepare on server2.
89 --let $rpl_connection_name= server2
90 --source include/rpl_connection.inc
91 # Signal debug sync to continue.
92 SET DEBUG_SYNC= 'now SIGNAL signal.after_applier_prepare_continue';
93 SET @@GLOBAL.DEBUG= '-d,group_replication_wait_on_after_applier_prepare';
94
95
96 --echo
97 --echo ############################################################
98 --echo # 08. Resume the plugin stop.
99 --let $rpl_connection_name= server2
100 --source include/rpl_connection.inc
101 SET DEBUG_SYNC= "now SIGNAL signal.resume_stop_before_leave_the_group";
102 SET @@GLOBAL.DEBUG= '-d,group_replication_hold_stop_before_leave_the_group';
103
104 --let $rpl_connection_name= server_2_1
105 --source include/rpl_connection.inc
106 --reap
107
108 --let $group_replication_member_state= OFFLINE
109 --source include/gr_wait_for_member_state.inc
110 --source include/assert_and_disable_read_only.inc
111
112
113 --echo
114 --echo ############################################################
115 --echo # 09. Resume transaction T1.
116 --let $rpl_connection_name= server1
117 --source include/rpl_connection.inc
118 --reap
119
120
121 --echo
122 --echo ############################################################
123 --echo # 10. Clean up.
124 --let $rpl_connection_name= server1
125 --source include/rpl_connection.inc
126 SET @@SESSION.group_replication_consistency= DEFAULT;
127 DROP TABLE t1;
128 DROP TABLE t2;
129
130 --let $rpl_connection_name= server2
131 --source include/rpl_connection.inc
132 DROP TABLE t1;
133 DROP TABLE t2;
134
135 --source include/group_replication_end.inc