Debian Codegraph @

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

raw
1 ###############################################################################
2 # If donor endpoints fail it won't fallback to normal host and port.
3 #
4 # Test:
5 # 0. The test requires two servers
6 # 1. Install clone plugin on server1.
7 # 2. Configure a recovery endpoint with a port that do not have
8 # mysql server listening
9 # 3. Start server 1 and bootstrap group
10 # 4. Create some transactions to send to joiner
11 # 5. Change settings on recovery to speed up failure
12 # 6. Setup the server so group replication starts on boot
13 # Install the Clone plugin
14 # 7. Ensure clone is used on recovery
15 # 8. Recovery will fail and server state change to ERROR
16 # 9. Clone will fail connecting to donor
17 # 10. Distributed recovery will fail connecting to donor
18 # 11. Set recovery endpoints to DEFAULT and server 2 will be able to join
19 # 12. Stop server 2 and start it again, now it will receive donor default
20 # configuration for recovery
21 # 13. Cleanup
22 #
23 ###############################################################################
24
25 --source include/have_mysqld_monitoring_process.inc
26 --source include/have_clone_plugin.inc
27 --source include/have_group_replication_plugin.inc
28 --let $rpl_skip_group_replication_start= 1
29 --source include/group_replication.inc
30
31 --echo
32 --echo # 1. Install clone plugin on server1.
33
34 --let $rpl_connection_name= server1
35 --source include/rpl_connection.inc
36
37 --replace_result $CLONE_PLUGIN CLONE_PLUGIN
38 --eval INSTALL PLUGIN clone SONAME '$CLONE_PLUGIN'
39
40 --echo
41 --echo # 2. Configure a recovery endpoint with a port that do not have
42 --echo # mysql server listening
43
44 # Setting admin_port has no effect if admin_address is not specified because in
45 # that case the server maintains no administrative network interface.
46
47 --let $server1_admin_port= `SELECT @@GLOBAL.ADMIN_PORT`
48
49 --replace_result $server1_admin_port SERVER1_ADMIN_PORT
50 --eval SET @@GLOBAL.group_replication_advertise_recovery_endpoints = "127.0.0.1:$server1_admin_port"
51
52 --echo
53 --echo # 3. Start server 1 and bootstrap group
54
55 --source include/start_and_bootstrap_group_replication.inc
56
57 --echo
58 --echo # 4. Create some transactions to send to joiner
59
60 CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY , b INT);
61
62 INSERT INTO test.t1 (b) VALUES (1);
63 INSERT INTO test.t1 (b) VALUES (2);
64
65 --echo
66 --echo # 5. Change settings on recovery to speed up failure
67
68 --let $rpl_connection_name = server2
69 --source include/rpl_connection.inc
70
71 --let $_group_replication_local_address= `SELECT @@GLOBAL.group_replication_local_address`
72 --let $_group_replication_group_seeds= `SELECT @@GLOBAL.group_replication_group_seeds`
73 --let $_group_replication_start_on_boot= `SELECT @@GLOBAL.group_replication_start_on_boot`
74 --let $_group_replication_comm_stack= `SELECT @@GLOBAL.group_replication_communication_stack`
75
76
77 --let $plugin_list= $GROUP_REPLICATION
78 --let $mysqld_extra_settings= --log_error=$MYSQLTEST_VARDIR/tmp/gr_recovery_endpoints_no_fallback.2.err
79 --source include/spawn_monitoring_process.inc
80
81 SET GLOBAL group_replication_recovery_reconnect_interval= 1;
82 SET GLOBAL group_replication_recovery_retry_count= 2;
83
84 --echo
85 --echo # 6. Setup the server so group replication starts on boot
86 --echo # Install the Clone plugin
87
88 --disable_query_log
89 --eval SET PERSIST group_replication_group_name= "$group_replication_group_name"
90 --eval SET PERSIST group_replication_local_address= "$_group_replication_local_address"
91 --eval SET PERSIST group_replication_group_seeds= "$_group_replication_group_seeds"
92 --eval SET PERSIST group_replication_communication_stack= "$_group_replication_comm_stack"
93
94 SET PERSIST group_replication_start_on_boot= ON;
95 --enable_query_log
96
97 --replace_result $CLONE_PLUGIN CLONE_PLUGIN
98 --eval INSTALL PLUGIN clone SONAME '$CLONE_PLUGIN'
99
100 --echo
101 --echo # 7. Ensure clone is used on recovery
102
103 --let $_group_replication_threshold_save= `SELECT @@GLOBAL.group_replication_clone_threshold`
104 SET GLOBAL group_replication_clone_threshold= 1;
105
106 --echo
107 --echo # 8. Recovery will fail and server state change to ERROR
108
109 --let $group_replication_start_member_state= ERROR
110 --source include/start_group_replication.inc
111
112 --echo
113 --echo # 9. Clone will fail connecting to donor
114
115 --let $assert_only_after = CURRENT_TEST: group_replication.gr_recovery_endpoints_no_fallback
116 --let $assert_file= $MYSQLTEST_VARDIR/tmp/gr_recovery_endpoints_no_fallback.2.err
117 --let $assert_count = 2
118 --let $assert_select = .*Clone Donor Error: Connect failed:.*
119 --let $assert_text = recovery channel used recovery endpoints configuration
120 --source include/assert_grep.inc
121
122 --echo
123 --echo # 10. Distributed recovery will fail connecting to donor
124
125 --let $assert_only_after = CURRENT_TEST: group_replication.gr_recovery_endpoints_no_fallback
126 --let $assert_file= $MYSQLTEST_VARDIR/tmp/gr_recovery_endpoints_no_fallback.2.err
127 --let $assert_count = 2
128 --let $assert_select = .*Error connecting to source '[email protected]:$server1_admin_port'.*
129 --let $assert_text = recovery channel used recovery endpoints configuration
130 --source include/assert_grep.inc
131
132 --echo
133 --echo # 11. Set recovery endpoints to DEFAULT and server 2 will be able to join
134
135 --let $rpl_connection_name = server1
136 --source include/rpl_connection.inc
137
138 SET @@GLOBAL.group_replication_advertise_recovery_endpoints = "DEFAULT";
139
140 --echo
141 --echo # 12. Stop server 2 and start it again, now it will receive donor default
142 --echo # configuration for recovery
143
144 --let $rpl_connection_name = server2
145 --source include/rpl_connection.inc
146
147 --source include/stop_group_replication.inc
148
149 START GROUP_REPLICATION;
150
151 --source include/wait_until_disconnected.inc
152
153 --let $rpl_server_number= 2
154 --source include/rpl_reconnect.inc
155
156 --let $group_replication_member_state=ONLINE
157 --source include/gr_wait_for_member_state.inc
158
159 --echo
160 --echo # 13. Cleanup
161
162 DROP TABLE test.t1;
163
164 --source include/rpl_sync.inc
165
166 set session sql_log_bin=0;
167 call mtr.add_suppression("There was an error when connecting to the donor*");
168 call mtr.add_suppression("For details please check performance_schema.replication_connection_status table and error log messages of Replica I/O for channel group_replication_recovery.");
169 call mtr.add_suppression("Maximum number of retries when*");
170 call mtr.add_suppression("Fatal error during the incremental recovery process of Group Replication.*");
171 call mtr.add_suppression("Skipping leave operation: concurrent attempt to leave the group is on-going.");
172 call mtr.add_suppression("The server was automatically set into read only mode after an error was detected.");
173 call mtr.add_suppression("Due to the number of missing transactions being higher than the configured threshold of*");
174 call mtr.add_suppression("Clone removing all user data for provisioning: Started");
175 call mtr.add_suppression("Clone removing all user data for provisioning: Finished");
176 call mtr.add_suppression("Internal query: CLONE INSTANCE FROM 'root'@'127.0.0.1':.*");
177 call mtr.add_suppression("There was an issue when cloning from another server: Error number: 3862*");
178 call mtr.add_suppression("Due to some issue on the previous step distributed recovery is now executing: Incremental Recovery.");
179 call mtr.add_suppression("Failed to shutdown components infrastructure.");
180 set session sql_log_bin=1;
181
182 --eval SET GLOBAL group_replication_clone_threshold= $_group_replication_threshold_save
183
184 RESET PERSIST IF EXISTS group_replication_group_name;
185 RESET PERSIST IF EXISTS group_replication_local_address;
186 RESET PERSIST IF EXISTS group_replication_group_seeds;
187 RESET PERSIST IF EXISTS group_replication_start_on_boot;
188 RESET PERSIST IF EXISTS group_replication_communication_stack;
189
190 --replace_result $_group_replication_start_on_boot START_ON_BOOT_VALUE
191 --eval SET GLOBAL group_replication_start_on_boot= $_group_replication_start_on_boot
192
193 --source include/clean_monitoring_process.inc
194
195 UNINSTALL PLUGIN clone;
196
197 --let $rpl_connection_name= server1
198 --source include/rpl_connection.inc
199
200 UNINSTALL PLUGIN clone;
201
202 --source include/group_replication_end.inc