| 1 |
################################################################################ |
| 2 |
# The test verifies the 'START GROUP_REPLICATION' behavior with different GR |
| 3 |
# configuration variables. |
| 4 |
# |
| 5 |
# Test: |
| 6 |
# 0. The test requires two servers: M1 and M2. |
| 7 |
# 1. Try setting invalid values to group_replication_bootstrap_group variable. |
| 8 |
# It must fail. |
| 9 |
# 2. Try start Group Replication on M1 without configuring any communication |
| 10 |
# engine parameter, start must fail. |
| 11 |
# 3. Try start Group Replication on M1 with only bootstrap parameter enabled, |
| 12 |
# start must fail. |
| 13 |
# 4. Try start Group Replication on M1 with invalid local_address parameter set, |
| 14 |
# start must fail. |
| 15 |
# 5. Try start Group Replication on M1 with only local_address parameter set, |
| 16 |
# start must fail. |
| 17 |
# 6. Try start Group Replication on M1 with bootstrap parameter enabled and |
| 18 |
# group_seeds, start must fail on M1. |
| 19 |
# 7. Try start Group Replication on M1 with bootstrap parameter enabled and |
| 20 |
# local_address, start must succeed on M1. M1 should come ONLINE. |
| 21 |
# 8. Try start Group Replication on M2 with invalid group_seeds, start must |
| 22 |
# fail. |
| 23 |
# 9. Try start Group Replication on M2 with invalid group_seeds, start must |
| 24 |
# fail. |
| 25 |
# 10. Try start Group Replication on server2 with |
| 26 |
# local_address and group_seeds set to NULL, start |
| 27 |
# must fail. |
| 28 |
# 11. Try start Group Replication on M2 with valid local_address and |
| 29 |
# group_seeds, start must succeed. M2 should come ONLINE. |
| 30 |
# 12. We must have a group with two members. |
| 31 |
# 13. Clean up. |
| 32 |
################################################################################ |
| 33 |
--source include/big_test.inc |
| 34 |
--source include/not_have_privilege_checks_user.inc |
| 35 |
--source include/have_group_replication_plugin.inc |
| 36 |
--let $rpl_skip_group_replication_start= 1 |
| 37 |
--source include/group_replication.inc |
| 38 |
|
| 39 |
# Suppress expected errors on error log. |
| 40 |
--let $rpl_connection_name= server1 |
| 41 |
--source include/rpl_connection.inc |
| 42 |
SET SESSION sql_log_bin= 0; |
| 43 |
call mtr.add_suppression("Unable to initialize the group communication engine"); |
| 44 |
call mtr.add_suppression("Error on group communication engine initialization"); |
| 45 |
call mtr.add_suppression("Error on group communication engine start"); |
| 46 |
call mtr.add_suppression("Invalid hostname or IP address \\(.*\\) assigned to the parameter local_node!"); |
| 47 |
call mtr.add_suppression("\\[GCS\\] Unable to join the group: peers not configured."); |
| 48 |
call mtr.add_suppression("\\[GCS\\] Timeout while waiting for the group communication engine to exit!"); |
| 49 |
call mtr.add_suppression("\\[GCS\\] The member has failed to gracefully leave the group."); |
| 50 |
call mtr.add_suppression("\\[GCS\\] None of the provided peer address is valid."); |
| 51 |
call mtr.add_suppression("\\[GCS\\] read failed"); |
| 52 |
call mtr.add_suppression("\\[GCS\\] Invalid hostname or IP address.*"); |
| 53 |
call mtr.add_suppression("\\[GCS\\] The group_name, peer_nodes, local_node,"); |
| 54 |
SET SESSION sql_log_bin= 1; |
| 55 |
--let $rpl_connection_name= server2 |
| 56 |
--source include/rpl_connection.inc |
| 57 |
SET SESSION sql_log_bin= 0; |
| 58 |
call mtr.add_suppression("Unable to initialize the group communication engine"); |
| 59 |
call mtr.add_suppression("Error on group communication engine initialization"); |
| 60 |
call mtr.add_suppression("Peer address .* is not valid."); |
| 61 |
call mtr.add_suppression("\\[GCS\\] The group_name, peer_nodes, local_node or bootstrap_group parameters were not specified."); |
| 62 |
call mtr.add_suppression("\\[GCS\\] Timeout while waiting for the group communication engine to exit!"); |
| 63 |
call mtr.add_suppression("\\[GCS\\] The member has failed to gracefully leave the group."); |
| 64 |
call mtr.add_suppression("\\[GCS\\] None of the provided peer address is valid."); |
| 65 |
call mtr.add_suppression("\\[GCS\\] read failed"); |
| 66 |
call mtr.add_suppression("\\[GCS\\] The group_name, peer_nodes, local_node,"); |
| 67 |
SET SESSION sql_log_bin= 1; |
| 68 |
|
| 69 |
# Hide generated group name from result file. |
| 70 |
--let $rpl_connection_name= server1 |
| 71 |
--source include/rpl_connection.inc |
| 72 |
--disable_query_log |
| 73 |
--eval SET GLOBAL group_replication_group_name= "$group_replication_group_name" |
| 74 |
--enable_query_log |
| 75 |
--let $rpl_connection_name= server2 |
| 76 |
--source include/rpl_connection.inc |
| 77 |
--disable_query_log |
| 78 |
--eval SET GLOBAL group_replication_group_name= "$group_replication_group_name" |
| 79 |
--enable_query_log |
| 80 |
|
| 81 |
# Save XCom configuration. |
| 82 |
--let $rpl_connection_name= server1 |
| 83 |
--source include/rpl_connection.inc |
| 84 |
SET @local_address= @@GLOBAL.group_replication_local_address; |
| 85 |
SET @group_seeds= @@GLOBAL.group_replication_group_seeds; |
| 86 |
--let $rpl_connection_name= server2 |
| 87 |
--source include/rpl_connection.inc |
| 88 |
SET @local_address= @@GLOBAL.group_replication_local_address; |
| 89 |
SET @group_seeds= @@GLOBAL.group_replication_group_seeds; |
| 90 |
|
| 91 |
# Clear XCom configuration on all servers. |
| 92 |
--source include/gr_clear_configuration.inc |
| 93 |
|
| 94 |
--replace_result $_group_replication_ip_allowlist GROUP_LOCAL_IP_ALLOWLIST |
| 95 |
--eval SET PERSIST group_replication_ip_allowlist= "$_group_replication_ip_allowlist" |
| 96 |
|
| 97 |
--let $rpl_connection_name= server1 |
| 98 |
--source include/rpl_connection.inc |
| 99 |
|
| 100 |
--replace_result $_group_replication_ip_allowlist GROUP_LOCAL_IP_ALLOWLIST |
| 101 |
--eval SET PERSIST group_replication_ip_allowlist= "$_group_replication_ip_allowlist" |
| 102 |
|
| 103 |
--let $rpl_connection_name= server2 |
| 104 |
--source include/rpl_connection.inc |
| 105 |
|
| 106 |
--echo ####################################################### |
| 107 |
--echo # 1. Try setting bootstrap_group variable with invalid |
| 108 |
--echo # values. It must fail. |
| 109 |
--error ER_WRONG_VALUE_FOR_VAR |
| 110 |
SET GLOBAL group_replication_bootstrap_group= NULL; |
| 111 |
|
| 112 |
--error ER_WRONG_VALUE_FOR_VAR |
| 113 |
SET GLOBAL group_replication_bootstrap_group= "a"; |
| 114 |
|
| 115 |
--error ER_WRONG_TYPE_FOR_VAR |
| 116 |
SET GLOBAL group_replication_bootstrap_group= 1.2; |
| 117 |
|
| 118 |
--echo ####################################################### |
| 119 |
--echo # 2. Try start Group Replication without configure any |
| 120 |
--echo # communication engine parameter, start must fail. |
| 121 |
--let $rpl_connection_name= server1 |
| 122 |
--source include/rpl_connection.inc |
| 123 |
--error ER_GROUP_REPLICATION_COMMUNICATION_LAYER_SESSION_ERROR |
| 124 |
START GROUP_REPLICATION; |
| 125 |
|
| 126 |
--let $member_state= query_get_value(SELECT Member_State from performance_schema.replication_group_members, Member_State, 1) |
| 127 |
--let $assert_text= The value of member_state must be offline |
| 128 |
--let $assert_cond= "$member_state" = "OFFLINE" |
| 129 |
--source include/assert.inc |
| 130 |
|
| 131 |
|
| 132 |
--echo ####################################################### |
| 133 |
--echo # 3. Try start Group Replication with only bootstrap |
| 134 |
--echo # parameter enabled, start must fail. |
| 135 |
SET GLOBAL group_replication_bootstrap_group= 1; |
| 136 |
SET GLOBAL group_replication_local_address= ""; |
| 137 |
SET GLOBAL group_replication_group_seeds= ""; |
| 138 |
--error ER_GROUP_REPLICATION_COMMUNICATION_LAYER_SESSION_ERROR |
| 139 |
START GROUP_REPLICATION; |
| 140 |
|
| 141 |
--let $member_state= query_get_value(SELECT Member_State from performance_schema.replication_group_members, Member_State, 1) |
| 142 |
--let $assert_text= The value of member_state must be offline |
| 143 |
--let $assert_cond= "$member_state" = "OFFLINE" |
| 144 |
--source include/assert.inc |
| 145 |
|
| 146 |
|
| 147 |
--echo ####################################################### |
| 148 |
--echo # 4. Try start Group Replication with invalid |
| 149 |
--echo # local_address parameter set, start must fail. |
| 150 |
SET GLOBAL group_replication_bootstrap_group= 0; |
| 151 |
SET GLOBAL group_replication_local_address= "ola"; |
| 152 |
SET GLOBAL group_replication_group_seeds= ""; |
| 153 |
--error ER_GROUP_REPLICATION_COMMUNICATION_LAYER_SESSION_ERROR |
| 154 |
START GROUP_REPLICATION; |
| 155 |
|
| 156 |
--let $member_state= query_get_value(SELECT Member_State from performance_schema.replication_group_members, Member_State, 1) |
| 157 |
--let $assert_text= The value of member_state must be offline |
| 158 |
--let $assert_cond= "$member_state" = "OFFLINE" |
| 159 |
--source include/assert.inc |
| 160 |
|
| 161 |
|
| 162 |
--echo ####################################################### |
| 163 |
--echo # 5. Try start Group Replication with only local_address |
| 164 |
--echo # parameter set, start must fail. |
| 165 |
SET GLOBAL group_replication_bootstrap_group= 0; |
| 166 |
SET GLOBAL group_replication_local_address= @local_address; |
| 167 |
SET GLOBAL group_replication_group_seeds= ""; |
| 168 |
--error ER_GROUP_REPLICATION_COMMUNICATION_LAYER_JOIN_ERROR |
| 169 |
START GROUP_REPLICATION; |
| 170 |
|
| 171 |
--let $member_state= query_get_value(SELECT Member_State from performance_schema.replication_group_members, Member_State, 1) |
| 172 |
--let $assert_text= The value of member_state must be offline |
| 173 |
--let $assert_cond= "$member_state" = "OFFLINE" |
| 174 |
--source include/assert.inc |
| 175 |
|
| 176 |
|
| 177 |
--echo ####################################################### |
| 178 |
--echo # 6. Try start Group Replication with bootstrap |
| 179 |
--echo # parameter enable and group_seeds, start must |
| 180 |
--echo # fail. |
| 181 |
SET GLOBAL group_replication_bootstrap_group= 1; |
| 182 |
SET GLOBAL group_replication_local_address= ""; |
| 183 |
SET GLOBAL group_replication_group_seeds= @group_seeds; |
| 184 |
--error ER_GROUP_REPLICATION_COMMUNICATION_LAYER_SESSION_ERROR |
| 185 |
START GROUP_REPLICATION; |
| 186 |
|
| 187 |
--let $member_state= query_get_value(SELECT Member_State from performance_schema.replication_group_members, Member_State, 1) |
| 188 |
--let $assert_text= The value of member_state must be offline |
| 189 |
--let $assert_cond= "$member_state" = "OFFLINE" |
| 190 |
--source include/assert.inc |
| 191 |
|
| 192 |
|
| 193 |
--echo ####################################################### |
| 194 |
--echo # 7. Try start Group Replication with bootstrap |
| 195 |
--echo # parameter enable and local_address, start must |
| 196 |
--echo # succeed. |
| 197 |
SET GLOBAL group_replication_bootstrap_group= 1; |
| 198 |
SET GLOBAL group_replication_local_address= @local_address; |
| 199 |
SET GLOBAL group_replication_group_seeds= ""; |
| 200 |
|
| 201 |
# Need to execute change master again as the clear configuration above resets |
| 202 |
# the recovery channel created in the beginning. |
| 203 |
--disable_warnings |
| 204 |
CHANGE REPLICATION SOURCE TO SOURCE_USER='root', SOURCE_PASSWORD='' FOR CHANNEL 'group_replication_recovery'; |
| 205 |
--enable_warnings |
| 206 |
|
| 207 |
--source include/start_group_replication.inc |
| 208 |
|
| 209 |
|
| 210 |
--echo ####################################################### |
| 211 |
--echo # 8. Try start Group Replication on server2 with invalid |
| 212 |
--echo # invalid group_seeds, start must fail. |
| 213 |
--let $rpl_connection_name= server2 |
| 214 |
--source include/rpl_connection.inc |
| 215 |
SET GLOBAL group_replication_bootstrap_group= 0; |
| 216 |
SET GLOBAL group_replication_local_address= @local_address; |
| 217 |
SET GLOBAL group_replication_group_seeds= "ola"; |
| 218 |
--error ER_GROUP_REPLICATION_COMMUNICATION_LAYER_SESSION_ERROR |
| 219 |
START GROUP_REPLICATION; |
| 220 |
|
| 221 |
--let $member_state= query_get_value(SELECT Member_State from performance_schema.replication_group_members, Member_State, 1) |
| 222 |
--let $assert_text= The value of member_state must be offline |
| 223 |
--let $assert_cond= "$member_state" = "OFFLINE" |
| 224 |
--source include/assert.inc |
| 225 |
|
| 226 |
|
| 227 |
--echo ####################################################### |
| 228 |
--echo # 9. Try start Group Replication on server2 with |
| 229 |
--echo # invalid group_seeds, start must fail. |
| 230 |
SET GLOBAL group_replication_bootstrap_group= 0; |
| 231 |
SET GLOBAL group_replication_local_address= @local_address; |
| 232 |
--let $invalid= `SELECT REPLACE(@group_seeds, ',', ';')` |
| 233 |
--disable_query_log |
| 234 |
--eval SET GLOBAL group_replication_group_seeds= "$invalid" |
| 235 |
--enable_query_log |
| 236 |
--error ER_GROUP_REPLICATION_COMMUNICATION_LAYER_SESSION_ERROR |
| 237 |
START GROUP_REPLICATION; |
| 238 |
|
| 239 |
--let $member_state= query_get_value(SELECT Member_State from performance_schema.replication_group_members, Member_State, 1) |
| 240 |
--let $assert_text= The value of member_state must be offline |
| 241 |
--let $assert_cond= "$member_state" = "OFFLINE" |
| 242 |
--source include/assert.inc |
| 243 |
|
| 244 |
|
| 245 |
--echo ####################################################### |
| 246 |
--echo # 10. Try start Group Replication on server2 with |
| 247 |
--echo # local_address and group_seeds set to NULL, start |
| 248 |
--echo # must fail. |
| 249 |
SET GLOBAL group_replication_bootstrap_group= 0; |
| 250 |
SET GLOBAL group_replication_local_address= NULL; |
| 251 |
SET GLOBAL group_replication_group_seeds= NULL; |
| 252 |
--error ER_GROUP_REPLICATION_COMMUNICATION_LAYER_SESSION_ERROR |
| 253 |
START GROUP_REPLICATION; |
| 254 |
|
| 255 |
--let $member_state= query_get_value(SELECT Member_State from performance_schema.replication_group_members, Member_State, 1) |
| 256 |
--let $assert_text= The value of member_state must be offline |
| 257 |
--let $assert_cond= "$member_state" = "OFFLINE" |
| 258 |
--source include/assert.inc |
| 259 |
|
| 260 |
|
| 261 |
--echo ####################################################### |
| 262 |
--echo # 11. Try start Group Replication on server2 with valid |
| 263 |
--echo # local_address and some invalid group_seeds, start must |
| 264 |
--echo # succeed. |
| 265 |
SET GLOBAL group_replication_bootstrap_group= 0; |
| 266 |
SET GLOBAL group_replication_local_address= @local_address; |
| 267 |
|
| 268 |
--let $invalid_with_valid= `SELECT CONCAT(@group_seeds, ',', 'ola:1234')` |
| 269 |
--disable_query_log |
| 270 |
--eval SET GLOBAL group_replication_group_seeds= "$invalid_with_valid" |
| 271 |
--enable_query_log |
| 272 |
|
| 273 |
# Need to execute change master again as the clear configuration above resets |
| 274 |
# the recovery channel created in the beginning. |
| 275 |
--disable_warnings |
| 276 |
CHANGE REPLICATION SOURCE TO SOURCE_USER='root', SOURCE_PASSWORD='' FOR CHANNEL 'group_replication_recovery'; |
| 277 |
--enable_warnings |
| 278 |
|
| 279 |
--source include/start_group_replication.inc |
| 280 |
|
| 281 |
|
| 282 |
--echo ####################################################### |
| 283 |
--echo # 12. We must have a group with two members. |
| 284 |
--let $rpl_connection_name= server1 |
| 285 |
--source include/rpl_connection.inc |
| 286 |
--let $group_replication_number_of_members= 2 |
| 287 |
--source include/gr_wait_for_number_of_members.inc |
| 288 |
--let $rpl_connection_name= server2 |
| 289 |
--source include/rpl_connection.inc |
| 290 |
--let $group_replication_number_of_members= 2 |
| 291 |
--source include/gr_wait_for_number_of_members.inc |
| 292 |
|
| 293 |
--echo ####################################################### |
| 294 |
--echo # 13. Cleanup. |
| 295 |
SET GLOBAL group_replication_group_seeds= @group_seeds; |
| 296 |
--source include/group_replication_end.inc |