Debian Codegraph @

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

raw
1 ################################################################################
2 # Validate that when a server joins a group and is not able to find
3 # a suitable donor it errors out and does not block on join.
4 #
5 # Test:
6 # 0. The test requires three servers: M1, M2 and M3.
7 # 1. Create a group with three members and schedule a periodic event to create
8 # some load in the group on M1.
9 # 2. Add suppressions.
10 # 3. Block applier channel on M1 so that joinining members that will recover
11 # from it will be blocked on recovery waiting for the View_change_log_event.
12 # 4. Stop and start M2 and M3. M2 and M3 will be in recovery.
13 # 5. Stop and start M1. M1 will be in recovery since all existent group members
14 # are RECOVERING.
15 # 6. Clean up.
16 ################################################################################
17 --source include/big_test.inc
18 --source include/have_debug_sync.inc
19 --source include/set_privilege_checks_user_as_system_user.inc
20 --source include/have_group_replication_plugin.inc
21
22
23 --echo
24 --echo ############################################################
25 --echo # 1. Create a group with 1 member and schedule a periodic
26 --echo # event to create some load in the group.
27 --let $rpl_server_count= 3
28 --source include/group_replication.inc
29
30 --let $rpl_connection_name= server1
31 --source include/rpl_connection.inc
32 --let $server1_uuid= `SELECT @@GLOBAL.SERVER_UUID`
33 SET SESSION sql_log_bin= 0;
34 call mtr.add_suppression("On shutdown there was a timeout on the Group Replication recovery module termination. Check the log for more details");
35 call mtr.add_suppression("Fatal error during the incremental recovery process of Group Replication. The server will leave the group.");
36 call mtr.add_suppression("The server was automatically set into read only mode after an error was detected.");
37 call mtr.add_suppression("Error leaving the group");
38 call mtr.add_suppression("All donors left. Aborting group replication incremental recovery.");
39 call mtr.add_suppression("This member has more executed transactions *.*");
40 call mtr.add_suppression("The member contains transactions not present in the group. It is only allowed to *.*");
41 call mtr.add_suppression("The member is already leaving or joining a group.");
42 call mtr.add_suppression("Skipping leave operation: member already left the group.");
43 call mtr.add_suppression("Skipping leave operation: concurrent attempt to leave the group is on-going.");
44 call mtr.add_suppression("Maximum number of retries when trying to connect to a donor reached. Aborting group replication incremental recovery.");
45 call mtr.add_suppression("Transaction cannot be executed while Group Replication is stopping.");
46 call mtr.add_suppression("Run function 'before_commit' in plugin 'group_replication' failed");
47 call mtr.add_suppression("While leaving the group due to a stop, shutdown or failure there was a timeout receiving a view change. This can lead to a possible inconsistent state. Check the log for more details");
48 call mtr.add_suppression("On shutdown there was a timeout on the Group Replication applier termination.");
49 SET SESSION sql_log_bin= 1;
50
51 CREATE TABLE t1 (a INT PRIMARY KEY AUTO_INCREMENT NOT NULL);
52 SET @old_event_scheduler= @@global.event_scheduler;
53 SET GLOBAL EVENT_SCHEDULER= ON;
54 delimiter //;
55 CREATE EVENT IF NOT EXISTS e1
56 ON SCHEDULE
57 EVERY 1 SECOND
58 STARTS CURRENT_TIMESTAMP + INTERVAL 1 SECOND
59 ENDS CURRENT_TIMESTAMP + INTERVAL 40 SECOND
60 ON COMPLETION PRESERVE
61 ENABLE
62 COMMENT 'Test with events'
63 DO
64 BEGIN
65 DECLARE v INTEGER;
66 DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
67
68 SET v=0;
69
70 WHILE v < 10
71 DO
72 INSERT INTO test.t1 values (NULL);
73 SET v = v+1;
74 END WHILE;
75 END//
76
77 delimiter ;//
78
79
80 --echo
81 --echo ############################################################
82 --echo # 2. Add error suppressions.
83 --let $rpl_connection_name= server1
84 --source include/rpl_connection.inc
85 SET SESSION sql_log_bin = 0;
86 call mtr.add_suppression("Replica SQL for channel 'group_replication_applier': Relay log read failure: Could not parse relay log event entry.*");
87 call mtr.add_suppression("The applier thread execution was aborted. Unable to process more transactions, this member will now leave the group.");
88 call mtr.add_suppression("Fatal error during execution on the Applier process of Group Replication. The server will now leave the group.");
89 call mtr.add_suppression("The server was automatically set into read only mode after an error was detected.");
90 call mtr.add_suppression("Skipping leave operation: concurrent attempt to leave the group is on-going.");
91 SET SESSION sql_log_bin = 1;
92
93 --let $rpl_connection_name= server2
94 --source include/rpl_connection.inc
95 SET SESSION sql_log_bin= 0;
96 call mtr.add_suppression("On shutdown there was a timeout on the Group Replication recovery module termination. Check the log for more details");
97 call mtr.add_suppression("Replica SQL for channel 'group_replication_recovery': Could not execute Write_rows event on table test.t1; Duplicate entry.*");
98 call mtr.add_suppression("Fatal error during the incremental recovery process of Group Replication. The server will leave the group.");
99 call mtr.add_suppression("The server was automatically set into read only mode after an error was detected.");
100 call mtr.add_suppression("Error leaving the group");
101 call mtr.add_suppression("All donors left. Aborting group replication incremental recovery.");
102 call mtr.add_suppression("The member is already leaving or joining a group.");
103 call mtr.add_suppression("Skipping leave operation: member already left the group.");
104 call mtr.add_suppression("Skipping leave operation: concurrent attempt to leave the group is on-going.");
105 SET SESSION sql_log_bin= 1;
106
107 --let $rpl_connection_name= server3
108 --source include/rpl_connection.inc
109 SET SESSION sql_log_bin= 0;
110 call mtr.add_suppression("On shutdown there was a timeout on the Group Replication recovery module termination. Check the log for more details");
111 call mtr.add_suppression("Replica SQL for channel 'group_replication_recovery': Could not execute Write_rows event on table test.t1; Duplicate entry.*");
112 call mtr.add_suppression("Fatal error during the incremental recovery process of Group Replication. The server will leave the group.");
113 call mtr.add_suppression("The server was automatically set into read only mode after an error was detected.");
114 call mtr.add_suppression("Error leaving the group");
115 call mtr.add_suppression("All donors left. Aborting group replication incremental recovery.");
116 call mtr.add_suppression("The member is already leaving or joining a group.");
117 call mtr.add_suppression("Skipping leave operation: member already left the group.");
118 call mtr.add_suppression("Skipping leave operation: concurrent attempt to leave the group is on-going.");
119 --disable_query_log # No need for the result file to specify suppressions.
120 call mtr.add_suppression("While leaving the group due to a stop, shutdown or failure there was a timeout receiving a view change. This can lead to a possible inconsistent state. Check the log for more details");
121 --enable_query_log
122 SET SESSION sql_log_bin= 1;
123
124
125 --echo
126 --echo ############################################################
127 --echo # 3. Block applier channel on member 1 so that joinining
128 --echo # members that will recover from it will be blocked on
129 --echo # recovery waiting for the View_change_log_event on which
130 --echo # them joined.
131 --let $rpl_connection_name= server1
132 --source include/rpl_connection.inc
133 SET @@GLOBAL.DEBUG='+d,block_applier_updates';
134
135
136 --echo
137 --echo ############################################################
138 --echo # 4. Stop and start members 2 and 3 without waiting for
139 --echo # member status.
140 --let $rpl_connection_name= server2
141 --source include/rpl_connection.inc
142 STOP GROUP_REPLICATION;
143 --let $rpl_connection_name= server3
144 --source include/rpl_connection.inc
145 STOP GROUP_REPLICATION;
146
147 --let $rpl_connection_name= server2
148 --source include/rpl_connection.inc
149 --source include/start_group_replication_command.inc
150 --let $rpl_connection_name= server3
151 --source include/rpl_connection.inc
152 --source include/start_group_replication_command.inc
153
154 # Member 2 and 3 will be on recovery
155 --let $rpl_connection_name= server2
156 --source include/rpl_connection.inc
157 --let $group_replication_member_state= RECOVERING
158 --source include/gr_wait_for_member_state.inc
159
160 --let $rpl_connection_name= server3
161 --source include/rpl_connection.inc
162 --let $group_replication_member_state= RECOVERING
163 --source include/gr_wait_for_member_state.inc
164
165
166 --echo
167 --echo ############################################################
168 --echo # 5. Stop and start member 1.
169 --let $rpl_connection_name= server1
170 --source include/rpl_connection.inc
171 SET @group_replication_recovery_reconnect_interval_save= @@GLOBAL.group_replication_recovery_reconnect_interval;
172 SET GLOBAL group_replication_recovery_reconnect_interval= 1;
173 SET @group_replication_components_stop_timeout_save = @@GLOBAL.group_replication_components_stop_timeout;
174 SET GLOBAL group_replication_components_stop_timeout= 2;
175
176 SET DEBUG_SYNC = "now WAIT_FOR applier_read_blocked";
177 SET @@GLOBAL.DEBUG='-d,block_applier_updates';
178 SET @@GLOBAL.DEBUG='+d,force_sql_thread_error';
179 SET DEBUG_SYNC = "now SIGNAL resume_applier_read";
180 --let $group_replication_member_state= ERROR
181 --source include/gr_wait_for_member_state.inc
182 SET @@GLOBAL.DEBUG='-d,force_sql_thread_error';
183 SET DEBUG_SYNC= 'RESET';
184 --error 0, ER_GROUP_REPLICATION_STOP_APPLIER_THREAD_TIMEOUT
185 STOP GROUP_REPLICATION;
186 --source include/assert_and_disable_read_only.inc
187
188 # Remove all M1 data and force a RESET MASTER to allow server1 to
189 # join, despite intentionally has more transactions than the group.
190 ALTER EVENT e1 DISABLE;
191 --let $wait_timeout= 300
192 --let $wait_condition= SELECT status="DISABLED" FROM information_schema.events WHERE event_schema='test' AND event_name="e1"
193 --source include/wait_condition_or_abort.inc
194 SET GLOBAL EVENT_SCHEDULER= @old_event_scheduler;
195
196 DROP EVENT e1;
197 DROP TABLE t1;
198 RESET MASTER;
199
200 --source include/start_group_replication_command.inc
201
202 # Member 1 will be on recovery, since all existent group members
203 # are RECOVERING.
204 --let $group_replication_member_state= RECOVERING
205 --source include/gr_wait_for_member_state.inc
206
207
208 --echo
209 --echo ############################################################
210 --echo # 6. Clean up.
211 --let $rpl_connection_name= server1
212 --source include/rpl_connection.inc
213 --source include/stop_group_replication.inc
214 SET GLOBAL group_replication_recovery_reconnect_interval= @group_replication_recovery_reconnect_interval_save;
215 SET GLOBAl group_replication_components_stop_timeout = @group_replication_components_stop_timeout_save;
216
217 --let $rpl_connection_name= server2
218 --source include/rpl_connection.inc
219 --source include/stop_group_replication.inc
220 --disable_warnings
221 DROP EVENT IF EXISTS e1;
222 DROP TABLE IF EXISTS t1;
223 --enable_warnings
224
225 --let $rpl_connection_name= server3
226 --source include/rpl_connection.inc
227 --source include/stop_group_replication.inc
228 --disable_warnings
229 DROP EVENT IF EXISTS e1;
230 DROP TABLE IF EXISTS t1;
231 --enable_warnings
232
233 --source include/group_replication_end.inc