Debian Codegraph @

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

raw
1 ################################################################################
2 # Test that evaluates the safe guards that stop members from joining with
3 # transactions not present in the group.
4 #
5 # Here we test that a joiner can't sometimes enter the group when it has less
6 # executed transactions than the group in its total. This happens if the merge
7 # of the joiner executed and received sets is bigger than the group total set of
8 # GTIDs.
9 # In total the joiner has more transactions than the group, so it can't join.
10 #
11 # Test guide:
12 # 0) The test requires three servers: M1, M2 and M3.
13 # 1) With all the 3 members ONLINE, create a table on M1. Check 4 transactions
14 # belonging to the GROUP on M2 and M3. Block the applier on M2 so it can't
15 # apply remote transactions.
16 # 2) Execute more transaction on M1. Check 6 transactions belonging to the
17 # GROUP on M3 then make M3 leave.
18 # 3) Execute some more transactions and check M2 has applied none.
19 # 4) Remove M1 and M2.
20 # 5) Try bootstrap add M3 back to the group.
21 # 6) Check that M3 (the group) has less executed GTIDs than M2. M2 can't
22 # still join the group because M2 has more transactions when we take
23 # into account its received transactions.
24 # 7) Clean up.
25 ################################################################################
26
27 --source include/big_test.inc
28 --source include/have_debug_sync.inc
29 --let $group_replication_group_name= ba8c9f00-ec68-11e5-a837-0800200c9a66
30 --source include/have_group_replication_plugin.inc
31 --let $rpl_server_count= 3
32 --source include/group_replication.inc
33
34 # Suppress errors
35
36 --let $rpl_connection_name= server2
37 --source include/rpl_connection.inc
38
39 SET SESSION sql_log_bin= 0;
40 call mtr.add_suppression(".*This member has more executed transactions *.*");
41 call mtr.add_suppression(".*The member contains transactions not present *.*");
42 call mtr.add_suppression("Replica SQL for channel 'group_replication_applier': Relay log read failure: Could not parse relay log event entry.*");
43 call mtr.add_suppression("The applier thread execution was aborted. Unable to process more transactions, this member will now leave the group.");
44 call mtr.add_suppression("Fatal error during execution on the Applier process of Group Replication. The server will now leave the group.");
45 call mtr.add_suppression("The server was automatically set into read only mode after an error was detected.");
46 call mtr.add_suppression("Skipping leave operation: concurrent attempt to leave the group is on-going.");
47 SET SESSION sql_log_bin= 1;
48
49 --echo #
50 --echo # Create a table for testing on server 1
51 --echo #
52
53 --let $rpl_connection_name= server1
54 --source include/rpl_connection.inc
55
56 CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
57
58 --source include/rpl_sync.inc
59
60 --let $rpl_connection_name= server2
61 --source include/rpl_connection.inc
62
63 --let $assert_text= Server 2 has 4 transaction belonging to the group
64 --let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$group_replication_group_name:1-4";
65 --source include/assert.inc
66
67 --let $rpl_connection_name= server3
68 --source include/rpl_connection.inc
69
70 --let $assert_text= Server 3 has 4 transaction belonging to the group
71 --let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$group_replication_group_name:1-4";
72 --source include/assert.inc
73
74 --echo #
75 --echo # Step 1: Block the applier on server 2.
76 --echo #
77
78 --let $rpl_connection_name= server2
79 --source include/rpl_connection.inc
80
81 SET @@GLOBAL.DEBUG='+d,block_applier_updates';
82
83 --echo #
84 --echo # Step 2: Insert some transaction and remove server 3
85 --echo #
86
87 --let $rpl_connection_name= server1
88 --source include/rpl_connection.inc
89
90 INSERT INTO t1 VALUES (1);
91 INSERT INTO t1 VALUES (2);
92
93 --let $sync_slave_connection= server3
94 --source include/sync_slave_sql_with_master.inc
95
96 --let $assert_text= Server 3 has 6 transaction belonging to the group
97 --let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$group_replication_group_name:1-6";
98 --source include/assert.inc
99
100 --source include/stop_group_replication.inc
101
102 --echo #
103 --echo # Step 3: Insert more transactions. Assert that server 2 applied none
104 --echo #
105
106 --let $rpl_connection_name= server1
107 --source include/rpl_connection.inc
108
109 INSERT INTO t1 VALUES (3);
110 INSERT INTO t1 VALUES (4);
111
112 --let $rpl_connection_name= server2
113 --source include/rpl_connection.inc
114
115 --let $wait_condition= SELECT received_transaction_set="$group_replication_group_name:1-8" FROM performance_schema.replication_connection_status WHERE channel_name='group_replication_applier';
116 --source include/wait_condition.inc
117
118 --echo #
119 --echo # Step 4: Stop group replication on server 1 and server 2
120 --echo #
121
122 --let $rpl_connection_name= server2
123 --source include/rpl_connection.inc
124
125 # Stop before committing the received transactions.
126 SET DEBUG_SYNC = "now WAIT_FOR applier_read_blocked";
127 SET @@GLOBAL.DEBUG='-d,block_applier_updates';
128 SET @@GLOBAL.DEBUG='+d,force_sql_thread_error';
129 SET DEBUG_SYNC = "now SIGNAL resume_applier_read";
130 --let $group_replication_member_state= ERROR
131 --source include/gr_wait_for_member_state.inc
132 SET @@GLOBAL.DEBUG='-d,force_sql_thread_error';
133 SET DEBUG_SYNC= 'RESET';
134 --source include/stop_group_replication.inc
135
136 --let $rpl_connection_name= server1
137 --source include/rpl_connection.inc
138
139 --source include/stop_group_replication.inc
140
141 --echo #
142 --echo # Step 5: Boot the group again with server 3
143 --echo #
144
145 --let $rpl_connection_name= server3
146 --source include/rpl_connection.inc
147
148 --source include/start_and_bootstrap_group_replication.inc
149
150 --echo #
151 --echo # Step 6: Try to join server 2 that was less executed GTIDs
152 --echo # The start should fail as server 2 has more transactions in total
153 --echo #
154
155 --let $rpl_connection_name= server2
156 --source include/rpl_connection.inc
157
158 --let $assert_text= Server 2 has 4 transaction belonging to the group
159 --let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$group_replication_group_name:1-4";
160 --source include/assert.inc
161
162 --let $rpl_connection_name= server3
163 --source include/rpl_connection.inc
164
165 --let $assert_text= Server 3 has 7 transaction belonging to the group
166 --let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$group_replication_group_name:1-7";
167 --source include/assert.inc
168
169 --let $rpl_connection_name= server_2
170 --source include/rpl_connection.inc
171
172 LOCK TABLE t1 READ;
173
174 --let $rpl_connection_name= server2
175 --source include/rpl_connection.inc
176
177 --eval SET GLOBAL group_replication_group_name= "$group_replication_group_name"
178
179 --send
180 START GROUP_REPLICATION;
181
182 --let $rpl_connection_name= server_2
183 --source include/rpl_connection.inc
184
185 UNLOCK TABLES;
186
187 --let $rpl_connection_name= server2
188 --source include/rpl_connection.inc
189
190 --error ER_GROUP_REPLICATION_CONFIGURATION
191 --reap
192
193 #for safety wait for it to leave
194 --let $rpl_connection_name= server3
195 --source include/rpl_connection.inc
196
197 --let $group_replication_number_of_members= 1
198 --source include/gr_wait_for_number_of_members.inc
199
200 --echo #
201 --echo # Step 7: Clean up
202 --echo #
203
204 --let $rpl_connection_name= server3
205 --source include/rpl_connection.inc
206
207 --source include/stop_group_replication.inc
208
209 --let $rpl_connection_name= server1
210 --source include/rpl_connection.inc
211
212 --source include/start_and_bootstrap_group_replication.inc
213
214 --let $rpl_connection_name= server2
215 --source include/rpl_connection.inc
216
217 --source include/start_group_replication.inc
218
219 --let $rpl_connection_name= server3
220 --source include/rpl_connection.inc
221
222 --source include/start_group_replication.inc
223
224 DROP TABLE t1;
225
226 --source include/group_replication_end.inc