Debian Codegraph @

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

raw
1 ################################################################################
2 # Validate group_replication_consistency= 'AFTER' behaviour against member leaves,
3 # when a member leaves before any member acknowledges the prepare.
4 #
5 # Test:
6 # 00. The test requires three servers: M1, M2 and M3.
7 # 01. Create a table on the group.
8 # 02. Make server2 block before send its prepare message. This
9 # will allow us to deterministically remove server3 before
10 # any member send its acknowledge.
11 # 03. Make server3 block before send its prepare message. This
12 # will allow us to deterministically remove it from the
13 # group while others are waiting for its acknowledge.
14 # The not acknowledged transaction must rollback on server3.
15 # 04. Execute T1 on server1.
16 # 05. Wait until T1 is prepared on server2.
17 # 06. Wait until T1 is prepared on server3.
18 # 07. Make server3 do not send its prepare message and remove
19 # it from the group.
20 # 08. Make server2 resume and send its prepare message.
21 # 09. Wait until server3 is removed from the group. T1 will
22 # commit on server 1 and 2.
23 # 10. Clean up.
24 ################################################################################
25 --source include/big_test.inc
26 --source include/have_debug_sync.inc
27 --source include/have_group_replication_plugin.inc
28 --let $rpl_server_count= 3
29 --source include/group_replication.inc
30
31 --echo
32 --echo ############################################################
33 --echo # 01. Create a table on the group.
34 --let $rpl_connection_name= server1
35 --source include/rpl_connection.inc
36 CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY);
37
38
39 --echo
40 --echo ############################################################
41 --echo # 02. Make server2 block before send its prepare message. This
42 --echo # will allow us to deterministically remove server3 before
43 --echo # any member send its acknowledge.
44 --let $rpl_connection_name= server2
45 --source include/rpl_connection.inc
46 SET @@GLOBAL.DEBUG= '+d,group_replication_wait_before_message_send_after_applier_prepare';
47
48
49 --echo
50 --echo ############################################################
51 --echo # 03. Make server3 block before send its prepare message. This
52 --echo # will allow us to deterministically remove it from the
53 --echo # group while others are waiting for its acknowledge.
54 --echo # The not acknowledged transaction must rollback on server3.
55 --let $rpl_connection_name= server3
56 --source include/rpl_connection.inc
57 SET @@GLOBAL.DEBUG= '+d,group_replication_wait_on_supress_message_send_after_applier_prepare';
58
59 SET SESSION sql_log_bin= 0;
60 call mtr.add_suppression("Due to a plugin error, some transactions were unable to be certified and will now rollback.");
61 call mtr.add_suppression("Plugin group_replication reported: 'Error on transaction '.*:5' from session '.*' while waiting for being prepared on all group members.");
62 call mtr.add_suppression("Run function 'before_commit' in plugin 'group_replication' failed");
63 call mtr.add_suppression("Replica: Error on observer while running replication hook 'before_commit'. Error_code: MY-003100");
64 call mtr.add_suppression("Replica SQL for channel 'group_replication_applier': Error in Xid_log_event: Commit could not be completed, 'Error on observer while running replication hook 'before_commit'.', Error_code: MY-003100");
65 call mtr.add_suppression("Replica SQL for channel 'group_replication_applier': Worker 1 failed executing transaction '.*:5'; Error on observer while running replication hook 'before_commit'. Error_code: MY-003100");
66 call mtr.add_suppression("Replica SQL for channel 'group_replication_applier': ... The replica coordinator and worker threads are stopped.*");
67 call mtr.add_suppression("The applier thread execution was aborted. Unable to process more transactions, this member will now leave the group.");
68 call mtr.add_suppression("Fatal error during execution on the Applier process of Group Replication. The server will now leave the group.");
69 call mtr.add_suppression("Plugin group_replication reported: 'Skipping leave operation: concurrent attempt to leave the group is on-going.");
70 call mtr.add_suppression("The server was automatically set into read only mode after an error was detected.");
71 SET SESSION sql_log_bin= 1;
72
73
74 --echo
75 --echo ############################################################
76 --echo # 04. Execute T1 on server1.
77 --let $rpl_connection_name= server1
78 --source include/rpl_connection.inc
79 --send INSERT INTO t1 VALUES (1)
80
81
82 --echo
83 --echo ############################################################
84 --echo # 05. Wait until T1 is prepared on server2.
85 --let $rpl_connection_name= server2
86 --source include/rpl_connection.inc
87 # Wait for the debug sync to be reached.
88 SET DEBUG_SYNC= "now WAIT_FOR signal.after_before_message_send_after_applier_prepare_waiting";
89
90
91 --echo
92 --echo ############################################################
93 --echo # 06. Wait until T1 is prepared on server3.
94 --let $rpl_connection_name= server3
95 --source include/rpl_connection.inc
96 # Wait for the debug sync to be reached.
97 SET DEBUG_SYNC= "now WAIT_FOR signal.after_supress_message_send_after_applier_prepare_waiting";
98
99
100 --echo
101 --echo ############################################################
102 --echo # 07. Make server3 do not send its prepare message and remove
103 --echo # it from the group.
104 --let $rpl_connection_name= server3
105 --source include/rpl_connection.inc
106 # Signal debug sync to continue.
107 SET DEBUG_SYNC= 'now SIGNAL signal.after_supress_message_send_after_applier_prepare_continue';
108 SET @@GLOBAL.DEBUG= '-d,group_replication_wait_on_supress_message_send_after_applier_prepare';
109
110 --source include/stop_group_replication.inc
111
112 --let $assert_text= 'There are no values in table t1'
113 --let $assert_cond= [SELECT COUNT(*) AS count FROM t1, count, 1] = 0
114 --source include/assert.inc
115
116
117 --echo
118 --echo ############################################################
119 --echo # 08. Make server2 resume and send its prepare message.
120 --let $rpl_connection_name= server2
121 --source include/rpl_connection.inc
122 # Signal debug sync to continue.
123 SET DEBUG_SYNC= 'now SIGNAL signal.after_before_message_send_after_applier_prepare_continue';
124 SET @@GLOBAL.DEBUG= '-d,group_replication_wait_before_message_send_after_applier_prepare';
125
126
127 --echo
128 --echo ############################################################
129 --echo # 09. Wait until server3 is removed from the group. T1 will
130 --echo # commit on server 1 and 2.
131 --let $rpl_connection_name= server_1
132 --source include/rpl_connection.inc
133 --let $group_replication_number_of_members= 2
134 --source include/gr_wait_for_number_of_members.inc
135
136 --let $rpl_connection_name= server1
137 --source include/rpl_connection.inc
138 --reap
139
140 --let $assert_text= 'There is 1 value in table t1'
141 --let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE c1=1, count, 1] = 1
142 --source include/assert.inc
143
144 --let $rpl_connection_name= server2
145 --source include/rpl_connection.inc
146 --let $assert_text= 'There is 1 value in table t1'
147 --let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE c1=1, count, 1] = 1
148 --source include/assert.inc
149
150 --let $diff_tables=server1:t1, server2:t1
151 --source include/diff_tables.inc
152
153
154 --echo
155 --echo ############################################################
156 --echo # 10. Clean up.
157 --let $rpl_connection_name= server1
158 --source include/rpl_connection.inc
159 DROP TABLE t1;
160
161 --let $rpl_connection_name= server3
162 --source include/rpl_connection.inc
163 DROP TABLE t1;
164
165 --source include/group_replication_end.inc