Debian Codegraph @

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

raw
1 ###############################################################################
2 # This test verifies that if the recovery endpoints is DEFAULT recovery shall
3 # try clone from other donor if current fails.
4 #
5 # Test:
6 # 0. The test requires three servers
7 # 1. Install clone plugin on server1.
8 # 2. Bootstrap server1 and add some data
9 # 3. Restart server3 with a monitoring process (mysqld_safe) if needed
10 # 4. Setup the server so group replication starts on boot
11 # Install the Clone plugin
12 # 5. Ensure clone is used on recovery
13 # 6. Activate debug point that will simulate failure on first clone
14 # donor
15 # 7. On a empty server3 start group replication
16 # 8. Clone donor will fail due to debug point and succeed on second
17 # endpoint
18 # 9. Wait for server to restart and come back
19 # 10. Clone will continue iteration on recovery endpoints
20 # and will do recovery from second endpoint
21 # 11. Cleanup
22 #
23 ###############################################################################
24
25 --source include/have_debug_sync.inc
26 --source include/have_mysqld_monitoring_process.inc
27 --source include/have_clone_plugin.inc
28 --source include/have_group_replication_plugin.inc
29 --let $rpl_skip_group_replication_start= 1
30 --let $rpl_server_count= 3
31 --source include/group_replication.inc
32
33 --echo
34 --echo # 1. Install clone plugin on server1.
35
36 --let $rpl_connection_name= server1
37 --source include/rpl_connection.inc
38
39 --replace_result $CLONE_PLUGIN CLONE_PLUGIN
40 --eval INSTALL PLUGIN clone SONAME '$CLONE_PLUGIN'
41
42 --echo
43 --echo # 2. Bootstrap server1 and add some data
44
45 --source include/start_and_bootstrap_group_replication.inc
46
47 CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
48 INSERT INTO t1 VALUES (1);
49 INSERT INTO t1 VALUES (2);
50
51 --let $rpl_connection_name= server2
52 --source include/rpl_connection.inc
53
54 --replace_result $CLONE_PLUGIN CLONE_PLUGIN
55 --eval INSTALL PLUGIN clone SONAME '$CLONE_PLUGIN'
56
57 --source include/start_group_replication.inc
58
59 --echo
60 --echo # 3. Restart server3 with a monitoring process (mysqld_safe) if needed
61
62 --let $rpl_connection_name= server3
63 --source include/rpl_connection.inc
64
65 --let $_group_replication_local_address= `SELECT @@GLOBAL.group_replication_local_address`
66 --let $_group_replication_group_seeds= `SELECT @@GLOBAL.group_replication_group_seeds`
67 --let $_group_replication_start_on_boot= `SELECT @@GLOBAL.group_replication_start_on_boot`
68 --let $_group_replication_comm_stack= `SELECT @@GLOBAL.group_replication_communication_stack`
69
70 --let $plugin_list= $GROUP_REPLICATION
71 --source include/spawn_monitoring_process.inc
72
73 --echo
74 --echo # 4. Setup the server so group replication starts on boot
75 --echo # Install the Clone plugin
76
77 --disable_query_log
78 --eval SET PERSIST group_replication_group_name= "$group_replication_group_name"
79 --eval SET PERSIST group_replication_local_address= "$_group_replication_local_address"
80 --eval SET PERSIST group_replication_group_seeds= "$_group_replication_group_seeds"
81 --eval SET PERSIST group_replication_communication_stack= "$_group_replication_comm_stack"
82
83 SET PERSIST group_replication_start_on_boot= ON;
84 --enable_query_log
85
86 --replace_result $CLONE_PLUGIN CLONE_PLUGIN
87 --eval INSTALL PLUGIN clone SONAME '$CLONE_PLUGIN'
88
89 --echo
90 --echo # 5. Ensure clone is used on recovery
91
92 --let $_group_replication_threshold_save= `SELECT @@GLOBAL.group_replication_clone_threshold`
93 SET GLOBAL group_replication_clone_threshold= 1;
94
95 --echo
96 --echo # 6. Activate debug point that will simulate failure on first clone
97 --echo # donor
98
99 --let $rpl_connection_name= server3
100 --source include/rpl_connection.inc
101
102 SET @debug_save= @@GLOBAL.DEBUG;
103 SET @@GLOBAL.DEBUG='+d,gr_run_clone_query_fail_once';
104
105 --echo
106 --echo # 7. On a empty server3 start group replication
107
108 --let $rpl_connection_name= server3
109 --source include/rpl_connection.inc
110
111
112 --send START GROUP_REPLICATION
113
114 --let $rpl_connection_name= server_3
115 --source include/rpl_connection.inc
116
117 --echo
118 --echo # 8. Clone donor will fail due to debug point and succeed on second
119 --echo # endpoint
120
121 SET DEBUG_SYNC = "now WAIT_FOR signal.run_clone_query_waiting";
122 SET DEBUG_SYNC = "now SIGNAL signal.run_clone_query_continue";
123
124 --echo # 9. Wait for server to restart and come back
125
126 --let $rpl_connection_name= server3
127 --source include/rpl_connection.inc
128
129 --reap
130
131 --source include/wait_until_disconnected.inc
132
133 --let $rpl_server_number= 3
134 --source include/rpl_reconnect.inc
135
136 --let $group_replication_member_state=ONLINE
137 --source include/gr_wait_for_member_state.inc
138
139 --echo
140 --echo # 10. Clone will continue iteration on recovery endpoints
141 --echo # and will do recovery from second endpoint
142
143 --let $assert_text= Clone must be completed
144 --let $assert_cond= [SELECT state="Completed" FROM performance_schema.clone_status] = 1;
145 --source include/assert.inc
146
147 # See if the data has been properly cloned in server3
148 --let $diff_tables=server1:test.t1 ,server3:test.t1
149 --source include/diff_tables.inc
150
151 --echo
152 --echo # 11. Cleanup
153
154 SET @@GLOBAL.DEBUG= @debug_save;
155
156 --eval SET GLOBAL group_replication_clone_threshold= $_group_replication_threshold_save
157
158 RESET PERSIST IF EXISTS group_replication_group_name;
159 RESET PERSIST IF EXISTS group_replication_local_address;
160 RESET PERSIST IF EXISTS group_replication_group_seeds;
161 RESET PERSIST IF EXISTS group_replication_start_on_boot;
162 RESET PERSIST group_replication_communication_stack;
163
164 --replace_result $_group_replication_start_on_boot START_ON_BOOT_VALUE
165 --eval SET GLOBAL group_replication_start_on_boot= $_group_replication_start_on_boot
166
167 DROP TABLE t1;
168
169 --source include/rpl_sync.inc
170
171 set session sql_log_bin=0;
172 call mtr.add_suppression("Due to the number of missing transactions being higher than the configured threshold of*");
173 call mtr.add_suppression("Clone removing all user data for provisioning: Started");
174 call mtr.add_suppression("Clone removing all user data for provisioning: Finished");
175 call mtr.add_suppression("Server was not able to find a rotate event from source server to initialize relay log recovery for channel ''. Skipping relay log recovery for the channel.");
176 call mtr.add_suppression("Error during --relay-log-recovery: Could not locate rotate event from the source.");
177 call mtr.add_suppression("Applier metadata information for channel '' was found after a clone operation. Relay log recovery");
178 set session sql_log_bin=1;
179
180 --source include/clean_monitoring_process.inc
181
182 UNINSTALL PLUGIN clone;
183
184 # This should be done on include/rpl_change_topology_helper.inc
185 CHANGE REPLICATION SOURCE TO SOURCE_AUTO_POSITION= 0 FOR CHANNEL '';
186
187 --let $rpl_connection_name= server2
188 --source include/rpl_connection.inc
189
190 UNINSTALL PLUGIN clone;
191
192 --let $rpl_connection_name= server1
193 --source include/rpl_connection.inc
194
195 UNINSTALL PLUGIN clone;
196
197 --source include/group_replication_end.inc