File: gr_recovery_no_donors.test

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (233 lines) | stat: -rw-r--r-- 11,067 bytes parent folder | download
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
################################################################################
# Validate that when a server joins a group and is not able to find
# a suitable donor it errors out and does not block on join.
#
# Test:
# 0. The test requires three servers: M1, M2 and M3.
# 1. Create a group with three members and schedule a periodic event to create
#    some load in the group on M1.
# 2. Add suppressions.
# 3. Block applier channel on M1 so that joinining members that will recover
#    from it will be blocked on recovery waiting for the View_change_log_event.
# 4. Stop and start M2 and M3. M2 and M3 will be in recovery.
# 5. Stop and start M1. M1 will be in recovery since all existent group members
#    are RECOVERING.
# 6. Clean up.
################################################################################
--source include/big_test.inc
--source include/have_debug_sync.inc
--source include/set_privilege_checks_user_as_system_user.inc
--source include/have_group_replication_plugin.inc


--echo
--echo ############################################################
--echo # 1. Create a group with 1 member and schedule a periodic
--echo #    event to create some load in the group.
--let $rpl_server_count= 3
--source include/group_replication.inc

--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--let $server1_uuid= `SELECT @@GLOBAL.SERVER_UUID`
SET SESSION sql_log_bin= 0;
call mtr.add_suppression("On shutdown there was a timeout on the Group Replication recovery module termination. Check the log for more details");
call mtr.add_suppression("Fatal error during the incremental recovery process of Group Replication. The server will leave the group.");
call mtr.add_suppression("The server was automatically set into read only mode after an error was detected.");
call mtr.add_suppression("Error leaving the group");
call mtr.add_suppression("All donors left. Aborting group replication incremental recovery.");
call mtr.add_suppression("This member has more executed transactions *.*");
call mtr.add_suppression("The member contains transactions not present in the group. It is only allowed to *.*");
call mtr.add_suppression("The member is already leaving or joining a group.");
call mtr.add_suppression("Skipping leave operation: member already left the group.");
call mtr.add_suppression("Skipping leave operation: concurrent attempt to leave the group is on-going.");
call mtr.add_suppression("Maximum number of retries when trying to connect to a donor reached. Aborting group replication incremental recovery.");
call mtr.add_suppression("Transaction cannot be executed while Group Replication is stopping.");
call mtr.add_suppression("Run function 'before_commit' in plugin 'group_replication' failed");
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");
call mtr.add_suppression("On shutdown there was a timeout on the Group Replication applier termination.");
SET SESSION sql_log_bin= 1;

CREATE TABLE t1 (a INT PRIMARY KEY AUTO_INCREMENT NOT NULL);
SET @old_event_scheduler= @@global.event_scheduler;
SET GLOBAL EVENT_SCHEDULER= ON;
delimiter //;
CREATE EVENT IF NOT EXISTS e1
 ON SCHEDULE
  EVERY 1 SECOND
   STARTS CURRENT_TIMESTAMP + INTERVAL 1 SECOND
   ENDS CURRENT_TIMESTAMP + INTERVAL 40 SECOND
 ON COMPLETION PRESERVE
 ENABLE
 COMMENT 'Test with events'
 DO
 BEGIN
  DECLARE v INTEGER;
  DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;

  SET v=0;

  WHILE v < 10
  DO
   INSERT INTO test.t1 values (NULL);
   SET v = v+1;
  END WHILE;
END//

delimiter ;//


--echo
--echo ############################################################
--echo # 2. Add error suppressions.
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
SET SESSION sql_log_bin = 0;
call mtr.add_suppression("Replica SQL for channel 'group_replication_applier': Relay log read failure: Could not parse relay log event entry.*");
call mtr.add_suppression("The applier thread execution was aborted. Unable to process more transactions, this member will now leave the group.");
call mtr.add_suppression("Fatal error during execution on the Applier process of Group Replication. The server will now leave the group.");
call mtr.add_suppression("The server was automatically set into read only mode after an error was detected.");
call mtr.add_suppression("Skipping leave operation: concurrent attempt to leave the group is on-going.");
SET SESSION sql_log_bin = 1;

--let $rpl_connection_name= server2
--source include/rpl_connection.inc
SET SESSION sql_log_bin= 0;
call mtr.add_suppression("On shutdown there was a timeout on the Group Replication recovery module termination. Check the log for more details");
call mtr.add_suppression("Replica SQL for channel 'group_replication_recovery': Could not execute Write_rows event on table test.t1; Duplicate entry.*");
call mtr.add_suppression("Fatal error during the incremental recovery process of Group Replication. The server will leave the group.");
call mtr.add_suppression("The server was automatically set into read only mode after an error was detected.");
call mtr.add_suppression("Error leaving the group");
call mtr.add_suppression("All donors left. Aborting group replication incremental recovery.");
call mtr.add_suppression("The member is already leaving or joining a group.");
call mtr.add_suppression("Skipping leave operation: member already left the group.");
call mtr.add_suppression("Skipping leave operation: concurrent attempt to leave the group is on-going.");
SET SESSION sql_log_bin= 1;

--let $rpl_connection_name= server3
--source include/rpl_connection.inc
SET SESSION sql_log_bin= 0;
call mtr.add_suppression("On shutdown there was a timeout on the Group Replication recovery module termination. Check the log for more details");
call mtr.add_suppression("Replica SQL for channel 'group_replication_recovery': Could not execute Write_rows event on table test.t1; Duplicate entry.*");
call mtr.add_suppression("Fatal error during the incremental recovery process of Group Replication. The server will leave the group.");
call mtr.add_suppression("The server was automatically set into read only mode after an error was detected.");
call mtr.add_suppression("Error leaving the group");
call mtr.add_suppression("All donors left. Aborting group replication incremental recovery.");
call mtr.add_suppression("The member is already leaving or joining a group.");
call mtr.add_suppression("Skipping leave operation: member already left the group.");
call mtr.add_suppression("Skipping leave operation: concurrent attempt to leave the group is on-going.");
--disable_query_log # No need for the result file to specify suppressions.
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");
--enable_query_log
SET SESSION sql_log_bin= 1;


--echo
--echo ############################################################
--echo # 3. Block applier channel on member 1 so that joinining
--echo #    members that will recover from it will be blocked on
--echo #    recovery waiting for the View_change_log_event on which
--echo #    them joined.
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
SET @@GLOBAL.DEBUG='+d,block_applier_updates';


--echo
--echo ############################################################
--echo # 4. Stop and start members 2 and 3 without waiting for
--echo #    member status.
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
STOP GROUP_REPLICATION;
--let $rpl_connection_name= server3
--source include/rpl_connection.inc
STOP GROUP_REPLICATION;

--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--source include/start_group_replication_command.inc
--let $rpl_connection_name= server3
--source include/rpl_connection.inc
--source include/start_group_replication_command.inc

# Member 2 and 3 will be on recovery
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--let $group_replication_member_state= RECOVERING
--source include/gr_wait_for_member_state.inc

--let $rpl_connection_name= server3
--source include/rpl_connection.inc
--let $group_replication_member_state= RECOVERING
--source include/gr_wait_for_member_state.inc


--echo
--echo ############################################################
--echo # 5. Stop and start member 1.
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
SET @group_replication_recovery_reconnect_interval_save= @@GLOBAL.group_replication_recovery_reconnect_interval;
SET GLOBAL group_replication_recovery_reconnect_interval= 1;
SET @group_replication_components_stop_timeout_save = @@GLOBAL.group_replication_components_stop_timeout;
SET GLOBAL group_replication_components_stop_timeout= 2;

SET DEBUG_SYNC = "now WAIT_FOR applier_read_blocked";
SET @@GLOBAL.DEBUG='-d,block_applier_updates';
SET @@GLOBAL.DEBUG='+d,force_sql_thread_error';
SET DEBUG_SYNC = "now SIGNAL resume_applier_read";
--let $group_replication_member_state= ERROR
--source include/gr_wait_for_member_state.inc
SET @@GLOBAL.DEBUG='-d,force_sql_thread_error';
SET DEBUG_SYNC= 'RESET';
--error 0, ER_GROUP_REPLICATION_STOP_APPLIER_THREAD_TIMEOUT
STOP GROUP_REPLICATION;
--source include/assert_and_disable_read_only.inc

# Remove all M1 data and force a RESET MASTER to allow server1 to
# join, despite intentionally has more transactions than the group.
ALTER EVENT e1 DISABLE;
--let $wait_timeout= 300
--let $wait_condition= SELECT status="DISABLED" FROM information_schema.events WHERE event_schema='test' AND event_name="e1"
--source include/wait_condition_or_abort.inc
SET GLOBAL EVENT_SCHEDULER= @old_event_scheduler;

DROP EVENT e1;
DROP TABLE t1;
RESET MASTER;

--source include/start_group_replication_command.inc

# Member 1 will be on recovery, since all existent group members
# are RECOVERING.
--let $group_replication_member_state= RECOVERING
--source include/gr_wait_for_member_state.inc


--echo
--echo ############################################################
--echo # 6. Clean up.
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--source include/stop_group_replication.inc
SET GLOBAL group_replication_recovery_reconnect_interval= @group_replication_recovery_reconnect_interval_save;
SET GLOBAl group_replication_components_stop_timeout = @group_replication_components_stop_timeout_save;

--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--source include/stop_group_replication.inc
--disable_warnings
DROP EVENT IF EXISTS e1;
DROP TABLE IF EXISTS t1;
--enable_warnings

--let $rpl_connection_name= server3
--source include/rpl_connection.inc
--source include/stop_group_replication.inc
--disable_warnings
DROP EVENT IF EXISTS e1;
DROP TABLE IF EXISTS t1;
--enable_warnings

--source include/group_replication_end.inc