| 1 |
# ==== Purpose ==== |
| 2 |
# |
| 3 |
# The purpose of this test script is to verify the persistence of |
| 4 |
# PRIVILEGE_CHECKS_USERNAME, and PRIVILEGE_CHECKS_HOSTNAME in both |
| 5 |
# TABLE and FILE type of relay-log-info-repository. |
| 6 |
# |
| 7 |
# ==== Requirements ===== |
| 8 |
# |
| 9 |
# File type repo: |
| 10 |
# ------------------- |
| 11 |
# R.P.F1: CHANGE MASTER sets the PRIVILEGE_CHECKS_USER correctly. |
| 12 |
# R.P.F2: PRIVILEGE_CHECKS_USER persists after restarting the server. |
| 13 |
# |
| 14 |
# TABLE type repo: |
| 15 |
# ------------------- |
| 16 |
# R.P.T1: CHANGE MASTER sets the PRIVILEGE_CHECKS_USER correctly. |
| 17 |
# R.P.T2: PRIVILEGE_CHECKS_USER persists after restarting the server. |
| 18 |
# R.P.T3: RESET SLAVE should keep value of PRIVILEGE_CHECKS_USER. |
| 19 |
# |
| 20 |
# ERROR/Warning in following Test Cases: |
| 21 |
# ----------------- |
| 22 |
# For FILE repo: |
| 23 |
# --------- |
| 24 |
# R.E.F1: privilege_checks_username has more than 32 length. |
| 25 |
# R.E.F2: privilege_checks_hostname has more than 255 length. |
| 26 |
# R.E.F3: privilege_checks_hostname has @. |
| 27 |
# R.E.F5. privilege_checks_username is anonymous. |
| 28 |
# R.E.F6. privilege_checks_user is a non existent user. |
| 29 |
# |
| 30 |
# For TABLE repo: |
| 31 |
# ---------- |
| 32 |
# R.E.T1: privilege_checks_username has more than 32 length. |
| 33 |
# R.E.T2: privilege_checks_hostname has more than 255 length. |
| 34 |
# R.E.T3: privilege_checks_hostname has @. |
| 35 |
# R.E.T4. privilege_checks_username is NULL and privilege_checks_hostname is not |
| 36 |
# NULL. |
| 37 |
# R.E.T5. privilege_checks_username is anonymous. |
| 38 |
# R.E.T6. privilege_checks_user is a non existent user. |
| 39 |
# |
| 40 |
# ==== Implementation ==== |
| 41 |
# |
| 42 |
# Prerequisites: |
| 43 |
# 1. add mtr suppression statement for errors on various error test cases for |
| 44 |
# FILE and TABLE type repository. |
| 45 |
# 2. create user replication_applier to use in change master as |
| 46 |
# privilege_checks_user with REPLICATION_APPLIER privilege. |
| 47 |
# |
| 48 |
# TC.P.F1: CHANGE MASTER sets the PRIVILEGE_CHECKS_USER correctly. |
| 49 |
# 1. issue change master for channel "" to have PRIVILEGE_CHECKS_USER as |
| 50 |
# 'replication_applier'@'localhost'. |
| 51 |
# 2. verify that pfs table has correct PRIVILEGE_CHECKS_USER |
| 52 |
# 3. also verify privlege_checks_user info in repo file relay_info.log. |
| 53 |
# |
| 54 |
# TC.P.F2: PRIVILEGE_CHECKS_USER persists after restarting the server. |
| 55 |
# 1. restart the slave server. |
| 56 |
# 2. verify that pfs table has correct PRIVILEGE_CHECKS_USER |
| 57 |
# 3. also verify privlege_checks_user info in repo file relay_info.log. |
| 58 |
# |
| 59 |
# TC.P.T1: CHANGE MASTER sets the PRIVILEGE_CHECKS_USER correctly. |
| 60 |
# 1. create two channels ch1 and ch2 when slave is configured with TABLE type |
| 61 |
# repo. "ch1" has not PRIVILEGE_CHECKS_USER, "ch2" has |
| 62 |
# 'replication_applier'@'localhost' as PRIVILEGE_CHECK_USER. |
| 63 |
# 2. verify that there are three channel entries in both pfs and |
| 64 |
# slave_relay_log_info tables. |
| 65 |
# 3. verify that "ch1" has NULL, and (NULL,NULL) for PRIVILEGE_CHECKS_USER, |
| 66 |
# and (Privilege_checks_username, Privilege_checks_hostname) in |
| 67 |
# respectively pfs and slave_relay_log_info tables. |
| 68 |
# |
| 69 |
# TC.P.T2: PRIVILEGE_CHECKS_USER persists after restarting the server. |
| 70 |
# 1. restart the slave server. |
| 71 |
# 2. verify that there are three channel entries in both pfs and |
| 72 |
# slave_relay_log_info tables. |
| 73 |
# 3. verify that "ch1" has NULL, and (NULL,NULL) for PRIVILEGE_CHECKS_USER, |
| 74 |
# and (Privilege_checks_username, Privilege_checks_hostname) in |
| 75 |
# respectively pfs and slave_relay_log_info tables. |
| 76 |
# |
| 77 |
# TC.P.T3: RESET SLAVE should keep value of PRIVILEGE_CHECKS_USER. |
| 78 |
# 1. reset slave for channel "". |
| 79 |
# 2. verify that slave_relay_log_info table and pfs have 3 records. |
| 80 |
# 3. verify that "ch1" kept values for PRIVILEGE_CHECKS_USER, |
| 81 |
# and (Privilege_checks_username, Privilege_checks_hostname) in |
| 82 |
# respectively pfs and slave_relay_log_info tables. |
| 83 |
# |
| 84 |
# TC.E.F1: privilege_checks_username has more than 32 length. |
| 85 |
# a. CHANGE MASTER will result in ER_CLIENT_PRIVILEGE_CHECKS_USER_CORRUPT. |
| 86 |
# 1. issue change master for default channel "" to set |
| 87 |
# privilege_checks_user with privilege_check_username more than 32 char. |
| 88 |
# 2. change master fails due to ER_WRONG_STRING_LENGTH. |
| 89 |
# b. server start will result in ER_LOG_WARN_PRIVILEGE_CHECKS_USER_CORRUPT. |
| 90 |
# 1. set debug point simulate_priv_check_username_above_limit to simulate |
| 91 |
# failure of channel config due to more than 32 chars |
| 92 |
# privilege_checks_username. |
| 93 |
# 2. start the slave server. |
| 94 |
# 3. verify channel "" entry has privilege_checks_user = "<INVALID>". |
| 95 |
# c. SLAVE START will result in failure due to invalid config. |
| 96 |
# 1. start slave should fail due to ER_REPLICA_AM_INIT_REPOSITORY. |
| 97 |
# |
| 98 |
# TC.E.F2: privilege_checks_username has more than 255 length. |
| 99 |
# a. CHANGE MASTER will result in ER_CLIENT_PRIVILEGE_CHECKS_USER_CORRUPT. |
| 100 |
# 1. issue change master for default channel "" to set |
| 101 |
# privilege_checks_user with privilege_check_hostname more than 255 |
| 102 |
# char. |
| 103 |
# 2. change master fails due to ER_WRONG_STRING_LENGTH. |
| 104 |
# b. server start will result in ER_LOG_WARN_PRIVILEGE_CHECKS_USER_CORRUPT. |
| 105 |
# 1. set debug point simulate_priv_check_hostname_above_limit to simulate |
| 106 |
# failure of channel config due to more than 255 chars |
| 107 |
# privilege_checks_hostname. |
| 108 |
# 2. start the slave server. |
| 109 |
# 3. verify channel "" entry has privilege_checks_user = "<INVALID>". |
| 110 |
# c. SLAVE START will result in failure due to invalid config. |
| 111 |
# 1. start slave should fail due to ER_REPLICA_AM_INIT_REPOSITORY. |
| 112 |
# |
| 113 |
# TC.E.F3: privilege_checks_hostname has @. |
| 114 |
# a. CHANGE MASTER will result in ER_UNKNOWN_ERROR. |
| 115 |
# 1. issue change master for default channel "" to set |
| 116 |
# privilege_checks_user with privilege_check_hostname has @. |
| 117 |
# 2. change master fails due to ER_UNKNOWN_ERROR. |
| 118 |
# b. server start will result in ER_LOG_WARN_PRIVILEGE_CHECKS_USER_CORRUPT. |
| 119 |
# 1. create relay_info.log with privilege_checks_hostname to have @. |
| 120 |
# 2. start the slave server. |
| 121 |
# 3. verify channel "" entry has privilege_checks_user = "<INVALID>". |
| 122 |
# c. SLAVE START will result in failure due to invalid config. |
| 123 |
# 1. start slave should fail due to ER_REPLICA_AM_INIT_REPOSITORY. |
| 124 |
# |
| 125 |
# TC.E.F5. privilege_checks_username is anonymous. |
| 126 |
# a. CHANGE MASTER will result in |
| 127 |
# ER_CLIENT_PRIVILEGE_CHECKS_USER_CANNOT_BE_ANONYMOUS. |
| 128 |
# 1. issue change master for default channel "" to set |
| 129 |
# privilege_checks_user as ''@'localhost'. |
| 130 |
# 2. change master fails due to |
| 131 |
# ER_CLIENT_PRIVILEGE_CHECKS_USER_CANNOT_BE_ANONYMOUS. |
| 132 |
# b. server start will result in ER_LOG_WARN_PRIVILEGE_CHECKS_USER_CORRUPT. |
| 133 |
# 1. create relay_info.log with empty string for privilege_checks_hostname. |
| 134 |
# 2. start the slave server. |
| 135 |
# 3. verify channel "" entry has privilege_checks_user = "<INVALID>". |
| 136 |
# c. SLAVE START will result in failure due to invalid config. |
| 137 |
# 1. start slave should fail due to ER_REPLICA_AM_INIT_REPOSITORY. |
| 138 |
# |
| 139 |
# TC.E.F6. privilege_checks_user is a non existent user. |
| 140 |
# a. CHANGE MASTER will result in |
| 141 |
# ER_CLIENT_PRIVILEGE_CHECKS_USER_DOES_NOT_EXIST. |
| 142 |
# 1. issue change master for default channel "" to set |
| 143 |
# privilege_checks_user as 'replication_applier_nonexist@'localhost', |
| 144 |
# this user doesn't exist. |
| 145 |
# 2. change master fails due to |
| 146 |
# ER_CLIENT_PRIVILEGE_CHECKS_USER_DOES_NOT_EXIST. |
| 147 |
# b. server start will result in |
| 148 |
# ER_LOG_WARN_PRIVILEGE_CHECKS_USER_DOES_NOT_EXIST. |
| 149 |
# 1. create relay_info.log with replication_applier_nonexist for |
| 150 |
# privilege_checks_hostname. |
| 151 |
# 2. start the slave server. |
| 152 |
# 3. verify channel "" entry has privilege_checks_user = "<INVALID>". |
| 153 |
# c. SLAVE START will result in failure due to invalid config. |
| 154 |
# 1. start slave should fail due to ER_REPLICA_AM_INIT_REPOSITORY. |
| 155 |
# |
| 156 |
# TC.E.T1: privilege_checks_username has more than 32 length. |
| 157 |
# a. CHANGE MASTER will result in ER_CLIENT_PRIVILEGE_CHECKS_USER_CORRUPT. |
| 158 |
# 1. issue change master for default channel "ch1" to set |
| 159 |
# privilege_checks_user with privilege_check_username more than 32 char. |
| 160 |
# 2. change master fails due to ER_WRONG_STRING_LENGTH. |
| 161 |
# b. server start will result in ER_LOG_WARN_PRIVILEGE_CHECKS_USER_CORRUPT. |
| 162 |
# 1. set debug point simulate_priv_check_username_above_limit to simulate |
| 163 |
# failure of reading channel config of ch1 due to |
| 164 |
# privilege_checks_username having more than 32 chars. |
| 165 |
# 2. restart the slave server. |
| 166 |
# 3. verify that channel config entry of "ch1" in pfs table has "<INVALID>" |
| 167 |
# as PRIVILEGE_CHECKS_USER. |
| 168 |
# c. SLAVE START will result in failure due to invalid config. |
| 169 |
# 1. start slave should fail due to ER_REPLICA_AM_INIT_REPOSITORY. |
| 170 |
# |
| 171 |
# TC.E.T2: privilege_checks_hostname has more than 255 length. |
| 172 |
# a. CHANGE MASTER will result in ER_CLIENT_PRIVILEGE_CHECKS_USER_CORRUPT. |
| 173 |
# 1. issue change master for default channel "ch1" to set |
| 174 |
# privilege_checks_user with privilege_check_hostname more than 255 |
| 175 |
# char. |
| 176 |
# 2. change master fails due to ER_WRONG_STRING_LENGTH. |
| 177 |
# b. server start will result in ER_LOG_WARN_PRIVILEGE_CHECKS_USER_CORRUPT. |
| 178 |
# 1. set debug point simulate_priv_check_hostname_above_limit to simulate |
| 179 |
# failure of reading channel config of ch1 due to |
| 180 |
# privilege_checks_hostname having more than 255 chars. |
| 181 |
# 2. restart the slave server. |
| 182 |
# 3. verify that channel config entry of "ch1" in pfs table has "<INVALID>" |
| 183 |
# as PRIVILEGE_CHECKS_USER. |
| 184 |
# c. SLAVE START will result in failure due to invalid config. |
| 185 |
# 1. start slave should fail due to ER_REPLICA_AM_INIT_REPOSITORY. |
| 186 |
# |
| 187 |
# TC.E.T3: privilege_checks_hostname has @. |
| 188 |
# a. CHANGE MASTER will result in ER_UNKNOWN_ERROR. |
| 189 |
# 1. issue change master for default channel "ch1" to set |
| 190 |
# privilege_checks_user with privilege_check_hostname has @. |
| 191 |
# 2. change master fails due to ER_UNKNOWN_ERROR. |
| 192 |
# b. server start will result in ER_LOG_WARN_PRIVILEGE_CHECKS_USER_CORRUPT. |
| 193 |
# 1. update config entry of channel "ch1" in mysql.slave_relay_log_info to |
| 194 |
# 'l@calhost' in privilege_checks_hostname. |
| 195 |
# 2. restart the slave server. |
| 196 |
# 3. verify that channel config entry of "ch1" in pfs table has "<INVALID>" |
| 197 |
# as PRIVILEGE_CHECKS_USER. |
| 198 |
# c. SLAVE START will result in failure due to invalid config. |
| 199 |
# 1. start slave should fail due to ER_REPLICA_AM_INIT_REPOSITORY. |
| 200 |
# |
| 201 |
# TC.E.T4. privilege_checks_username is NULL and privilege_checks_hostname is |
| 202 |
# not NULL. |
| 203 |
# a. CHANGE MASTER will result in ER_CLIENT_PRIVILEGE_CHECKS_USER_CORRUPT. |
| 204 |
# b. server start will result in ER_LOG_WARN_PRIVILEGE_CHECKS_USER_CORRUPT. |
| 205 |
# c. SLAVE START will result in failure due to invalid config. |
| 206 |
# 1. start slave should fail due to ER_REPLICA_AM_INIT_REPOSITORY. |
| 207 |
# |
| 208 |
# TC.E.T5. privilege_checks_username is anonymous. |
| 209 |
# a. CHANGE MASTER will result in |
| 210 |
# ER_CLIENT_PRIVILEGE_CHECKS_USER_CANNOT_BE_ANONYMOUS. |
| 211 |
# 1. issue change master for default channel "" to set |
| 212 |
# privilege_checks_user as ''@'localhost'. |
| 213 |
# 2. change master fails due to |
| 214 |
# ER_CLIENT_PRIVILEGE_CHECKS_USER_CANNOT_BE_ANONYMOUS. |
| 215 |
|
| 216 |
# b. server start will result in ER_LOG_WARN_PRIVILEGE_CHECKS_USER_CORRUPT. |
| 217 |
# 1. update config entry of channel "ch1" in mysql.slave_relay_log_info to |
| 218 |
# '' in privilege_checks_username. |
| 219 |
# 2. restart the slave server. |
| 220 |
# 3. verify that channel config entry of "ch1" in pfs table has "<INVALID>" |
| 221 |
# as PRIVILEGE_CHECKS_USER. |
| 222 |
# c. SLAVE START will result in failure due to invalid config. |
| 223 |
# 1. start slave should fail due to ER_REPLICA_AM_INIT_REPOSITORY. |
| 224 |
# |
| 225 |
# TC.E.T6. privilege_checks_user is a non existent user. |
| 226 |
# a. CHANGE MASTER will result in |
| 227 |
# ER_CLIENT_PRIVILEGE_CHECKS_USER_DOES_NOT_EXIST. |
| 228 |
# 1. issue change master for default channel "" to set |
| 229 |
# privilege_checks_user as 'replication_applier_nonexist@'localhost', |
| 230 |
# this user doesn't exist. |
| 231 |
# 2. change master fails due to |
| 232 |
# ER_CLIENT_PRIVILEGE_CHECKS_USER_DOES_NOT_EXIST. |
| 233 |
# b. server start will result in |
| 234 |
# ER_LOG_WARN_PRIVILEGE_CHECKS_USER_DOES_NOT_EXIST. |
| 235 |
# 1. update config entry of channel "ch1" in mysql.slave_relay_log_info to |
| 236 |
# 'replication_applier_nonexist' in privilege_checks_username. |
| 237 |
# 2. restart the slave server. |
| 238 |
# 3. verify that channel config entry of "ch1" in pfs table has "<INVALID>" |
| 239 |
# as PRIVILEGE_CHECKS_USER. |
| 240 |
# c. SLAVE START will result in failure due to invalid config. |
| 241 |
# 1. start slave should fail due to ER_REPLICA_AM_INIT_REPOSITORY. |
| 242 |
# |
| 243 |
# ==== References ==== |
| 244 |
# |
| 245 |
# Step #7 of WL#12966 |
| 246 |
# |
| 247 |
|
| 248 |
--source include/have_debug.inc |
| 249 |
--source include/have_debug_sync.inc |
| 250 |
--source include/not_group_replication_plugin.inc |
| 251 |
--source include/not_master_info_file.inc |
| 252 |
--source include/have_binlog_format_row.inc |
| 253 |
--source include/not_mts_replica_parallel_workers.inc |
| 254 |
--source include/not_have_privilege_checks_user.inc |
| 255 |
--source include/master-slave.inc |
| 256 |
|
| 257 |
# When relay-log-info-repository=FILE, |
| 258 |
# mysql.slave_relay_log_info will not have config information for default |
| 259 |
# channel. performance_schema.replication_applier_configuration should have |
| 260 |
# entry for default channel "" with correct PRIVILEGE_CHECKS_USER. |
| 261 |
--write_file $MYSQL_TMP_DIR/assert_default_channel_config_with_file_repo.inc END_OF_PROCEDURE |
| 262 |
--let $assert_text = Check that mysql.slave_relay_log_info does not have any entry |
| 263 |
--let $assert_cond = [SELECT COUNT(*) FROM mysql.slave_relay_log_info WHERE CHANNEL_NAME=""] = 0 |
| 264 |
--source include/assert.inc |
| 265 |
|
| 266 |
--let $count = `SELECT COUNT(*) FROM performance_schema.replication_applier_configuration WHERE CHANNEL_NAME="" AND PRIVILEGE_CHECKS_USER="'replication_applier'@'localhost'"` |
| 267 |
--let $assert_text = Check entry for default channel "" in performance_schema.replication_applier_configuration |
| 268 |
--let $assert_cond = $count = 1 |
| 269 |
--source include/assert.inc |
| 270 |
END_OF_PROCEDURE |
| 271 |
|
| 272 |
--write_file $MYSQL_TMP_DIR/verify_priv_check_user_config_in_repo_file.inc END_OF_PROCEDURE |
| 273 |
--let $grep_file = $MYSQLD_DATADIR/$filename |
| 274 |
--let $grep_pattern = $priv_checks_username |
| 275 |
--source include/grep_pattern.inc |
| 276 |
|
| 277 |
--let $grep_pattern = $priv_checks_hostname |
| 278 |
--source include/grep_pattern.inc |
| 279 |
END_OF_PROCEDURE |
| 280 |
|
| 281 |
--write_file $MYSQL_TMP_DIR/restart_slave_with_debug_point.inc END_OF_PROCEDURE |
| 282 |
--let $rpl_server_number = 2 |
| 283 |
--let $rpl_force_stop=1 |
| 284 |
--source include/rpl_stop_server.inc |
| 285 |
--let $rpl_server_parameters=--skip_replica_start --debug=d,$debug_point |
| 286 |
--let $explicit_default_wait_counter = 15000 |
| 287 |
--source include/rpl_start_server.inc |
| 288 |
END_OF_PROCEDURE |
| 289 |
|
| 290 |
# validate that channel "" has privilege_checks_user as '<INVALID>' in |
| 291 |
# performance_schema.replication_applier_configuration |
| 292 |
# This is used after starting slave with invalid config for channel ''. |
| 293 |
--write_file $MYSQL_TMP_DIR/assert_default_channel_invalid_config_with_file_repo.inc END_OF_PROCEDURE |
| 294 |
SELECT * FROM performance_schema.replication_applier_configuration; |
| 295 |
--let $count = `SELECT COUNT(*) FROM performance_schema.replication_applier_configuration WHERE CHANNEL_NAME="" AND PRIVILEGE_CHECKS_USER="<INVALID>"` |
| 296 |
--let $assert_text = Check entry for default channel "" in performance_schema.replication_applier_configuration |
| 297 |
--let $assert_cond = $count = 1 |
| 298 |
--source include/assert.inc |
| 299 |
END_OF_PROCEDURE |
| 300 |
|
| 301 |
# Number of channel config entries in mysql.slave_relay_log_info and |
| 302 |
# performance_schema.replication_applier_configuration. Before each usage, |
| 303 |
# $channel will be set. |
| 304 |
# Both the tables should have $channel number of entires. |
| 305 |
--write_file $MYSQL_TMP_DIR/assert_config_entry_count_with_table_repo.inc END_OF_PROCEDURE |
| 306 |
--let $assert_text = Check that mysql.slave_relay_log_info has $num_channels entries for $num_channels channels |
| 307 |
--let $assert_cond = [SELECT COUNT(*) FROM mysql.slave_relay_log_info] = $num_channels |
| 308 |
--source include/assert.inc |
| 309 |
|
| 310 |
--let $assert_text = Check that performance_schema.replication_applier_configuration has $num_channels entries for $num_channels channels |
| 311 |
--let $assert_cond = [SELECT COUNT(*) FROM performance_schema.replication_applier_configuration] = $num_channels |
| 312 |
--source include/assert.inc |
| 313 |
END_OF_PROCEDURE |
| 314 |
|
| 315 |
# Verify (PRIVILEGE_CHECKS_USERNAME, PRIVILEGE_CHECKS_HOSTNAME) and |
| 316 |
# PRIVILEGE_CHECKS_USER information respectively in mysql.slave_relay_log_info |
| 317 |
# and performance_schema.replication_applier_configuration tables. Following |
| 318 |
# params are set before every usage: |
| 319 |
# priv_chks_user_expected_value: expected value of PRIVILEGE_CHECKS_USER. |
| 320 |
# priv_chks_username: expected value of PRIVILEGE_CHECKS_USERNAME. |
| 321 |
# priv_chks_hostname: expected value of PRIVILEGE_CHECKS_HOSTNAME. |
| 322 |
--write_file $MYSQL_TMP_DIR/assert_channel_config_with_table_repo.inc END_OF_PROCEDURE |
| 323 |
if ($priv_chks_user_expected_value == NULL) { |
| 324 |
--let $count1 = `SELECT COUNT(*) FROM performance_schema.replication_applier_configuration WHERE CHANNEL_NAME=$channel AND PRIVILEGE_CHECKS_USER IS NULL` |
| 325 |
} |
| 326 |
if ($priv_chks_user_expected_value != NULL) { |
| 327 |
--let $count1 = `SELECT COUNT(*) FROM performance_schema.replication_applier_configuration WHERE CHANNEL_NAME=$channel AND PRIVILEGE_CHECKS_USER="$priv_chks_user_expected_value"` |
| 328 |
} |
| 329 |
|
| 330 |
--let $priv_chks_username = query_get_value(SELECT Privilege_checks_username FROM mysql.slave_relay_log_info WHERE Channel_name=$channel, Privilege_checks_username, 1) |
| 331 |
--let $priv_chks_hostname = query_get_value(SELECT Privilege_checks_hostname FROM mysql.slave_relay_log_info WHERE Channel_name=$channel, Privilege_checks_hostname, 1) |
| 332 |
|
| 333 |
--let $assert_text = Check that priv_chks_username for channel $channel is correct |
| 334 |
--let $assert_cond = "$priv_chks_username" = "$priv_chks_username_expected_value" |
| 335 |
--source include/assert.inc |
| 336 |
|
| 337 |
--let $assert_text = Check that priv_chks_hostname for channel $channel is correct |
| 338 |
--let $assert_cond = "$priv_chks_hostname" = "$priv_chks_hostname_expected_value" |
| 339 |
--source include/assert.inc |
| 340 |
END_OF_PROCEDURE |
| 341 |
|
| 342 |
# Used the channel config in pfs after slave restart. |
| 343 |
# if debug_point is set then |
| 344 |
# - update given channel's given config in mysql.slave_relay_log_info. |
| 345 |
# force stop the slave server. |
| 346 |
# verify that pfs table "<INVALID>" entry for the given channel. |
| 347 |
--write_file $MYSQL_TMP_DIR/assert_channel_invalid_config_update_of_table_repo_entry.inc END_OF_PROCEDURE |
| 348 |
BEGIN; |
| 349 |
--eval UPDATE mysql.slave_relay_log_info SET Privilege_checks_username=$priv_chks_username, Privilege_checks_hostname=$priv_chks_hostname WHERE Channel_name=$channel |
| 350 |
COMMIT; |
| 351 |
|
| 352 |
--let $rpl_server_number = 2 |
| 353 |
--let $rpl_force_stop=1 |
| 354 |
if ($debug_point != '') { |
| 355 |
--let $rpl_server_parameters = --relay-log-info-repository=TABLE --skip_replica_start --debug=d,$debug_point,simulate_priv_check_user_nullptr_t |
| 356 |
} |
| 357 |
if ($debug_point == '') { |
| 358 |
--let $rpl_server_parameters = --relay-log-info-repository=TABLE --skip_replica_start |
| 359 |
} |
| 360 |
--let $explicit_default_wait_counter = 15000 |
| 361 |
--source include/rpl_restart_server.inc |
| 362 |
|
| 363 |
--let $count = `SELECT COUNT(*) FROM performance_schema.replication_applier_configuration WHERE CHANNEL_NAME=$channel AND PRIVILEGE_CHECKS_USER="<INVALID>"` |
| 364 |
--let $assert_text = Check entry for channel $channel in performance_schema.replication_applier_configuration |
| 365 |
--let $assert_cond = $count = 1 |
| 366 |
--source include/assert.inc |
| 367 |
END_OF_PROCEDURE |
| 368 |
|
| 369 |
--source include/rpl_connection_slave.inc |
| 370 |
|
| 371 |
# Prerequisites: |
| 372 |
# 1. add mtr suppression statement for errors on various error test cases for |
| 373 |
# FILE and TABLE type repository. |
| 374 |
CALL mtr.add_suppression("Error reading relay log configuration"); |
| 375 |
CALL mtr.add_suppression("Failed to create or recover replication info repositories"); |
| 376 |
|
| 377 |
# Adding suppression of errors/warning for FILE repo test cases. |
| 378 |
CALL mtr.add_suppression("Replica SQL for channel '': Invalid, corrupted PRIVILEGE_CHECKS_USER was found in the replication configuration repository"); |
| 379 |
CALL mtr.add_suppression("PRIVILEGE_CHECKS_USER for replication channel '' was set to `replication_applier_nonexist`@`localhost`, but this is not an existing user"); |
| 380 |
CALL mtr.add_suppression("Replica: Failed to initialize the connection metadata structure for channel '';"); |
| 381 |
CALL mtr.add_suppression("Replica SQL for channel '': Replica failed to initialize applier metadata structure from the repository"); |
| 382 |
|
| 383 |
# Adding suppression of errors/warning for TABLE repo test cases. |
| 384 |
CALL mtr.add_suppression("Replica SQL for channel 'ch1': Invalid, corrupted PRIVILEGE_CHECKS_USER was found in the replication configuration repository"); |
| 385 |
CALL mtr.add_suppression("PRIVILEGE_CHECKS_USER for replication channel 'ch1' was set to `replication_applier_nonexist`@`localhost`, but this is not an existing user"); |
| 386 |
CALL mtr.add_suppression("Replica: Failed to initialize the connection metadata structure for channel 'ch1';"); |
| 387 |
CALL mtr.add_suppression("Replica SQL for channel 'ch1': Replica failed to initialize applier metadata structure from the repository"); |
| 388 |
|
| 389 |
--let $MYSQLD_DATADIR= `select @@datadir` |
| 390 |
--let $filename = `SELECT @@relay_log_info_file` |
| 391 |
|
| 392 |
# 2. create user replication_applier to use in change master as |
| 393 |
# privilege_checks_user with REPLICATION_APPLIER privilege. |
| 394 |
CREATE USER 'replication_applier'@'localhost' IDENTIFIED BY 'password'; |
| 395 |
GRANT REPLICATION_APPLIER ON * . * TO 'replication_applier'@'localhost'; |
| 396 |
FLUSH PRIVILEGES; |
| 397 |
|
| 398 |
--echo # |
| 399 |
--echo # TC.P.F1: CHANGE MASTER sets the PRIVILEGE_CHECKS_USER correctly. |
| 400 |
--echo # |
| 401 |
# 1. issue change master for default channel "" to set privilege_checks_user. |
| 402 |
STOP SLAVE; |
| 403 |
# NULL value is accepted |
| 404 |
CHANGE REPLICATION SOURCE TO SOURCE_HOST="localhost", SOURCE_PORT=10, PRIVILEGE_CHECKS_USER=NULL; |
| 405 |
# and NON-NULL value is accepted |
| 406 |
CHANGE REPLICATION SOURCE TO SOURCE_HOST="localhost", SOURCE_PORT=10, PRIVILEGE_CHECKS_USER='replication_applier'@'localhost'; |
| 407 |
FLUSH RELAY LOGS; |
| 408 |
START SLAVE; |
| 409 |
# 2. verify that pfs table has correct PRIVILEGE_CHECKS_USER |
| 410 |
--source $MYSQL_TMP_DIR/assert_default_channel_config_with_file_repo.inc |
| 411 |
# 3. also verify privlege_checks_user info in repo file relay_info.log. |
| 412 |
--let $priv_checks_username = replication_applier |
| 413 |
--let $priv_checks_hostname = localhost |
| 414 |
--source $MYSQL_TMP_DIR/verify_priv_check_user_config_in_repo_file.inc |
| 415 |
|
| 416 |
--echo # |
| 417 |
--echo # TC.P.F2: PRIVILEGE_CHECKS_USER persists after restarting the server. |
| 418 |
--echo # |
| 419 |
# 1. restart the slave server. |
| 420 |
--let $rpl_server_number = 2 |
| 421 |
--let $explicit_default_wait_counter = 15000 |
| 422 |
--source include/rpl_restart_server.inc |
| 423 |
# 2. verify that pfs table has correct PRIVILEGE_CHECKS_USER |
| 424 |
--source $MYSQL_TMP_DIR/assert_default_channel_config_with_file_repo.inc |
| 425 |
--let $priv_checks_username = replication_applier |
| 426 |
--let $priv_checks_hostname = localhost |
| 427 |
# 3. also verify privlege_checks_user info in repo file relay_info.log. |
| 428 |
--source $MYSQL_TMP_DIR/verify_priv_check_user_config_in_repo_file.inc |
| 429 |
|
| 430 |
STOP SLAVE FOR CHANNEL ""; |
| 431 |
|
| 432 |
--echo # |
| 433 |
--echo # TC.E.F1: privilege_checks_username has more than 32 length. |
| 434 |
--echo # |
| 435 |
# a. CHANGE MASTER will result in ER_CLIENT_PRIVILEGE_CHECKS_USER_CORRUPT. |
| 436 |
--error ER_WRONG_STRING_LENGTH |
| 437 |
CHANGE REPLICATION SOURCE TO SOURCE_HOST="localhost", SOURCE_PORT=10, PRIVILEGE_CHECKS_USER='repli_priv_checks_user_more_than_32'@'localhost' FOR CHANNEL ""; |
| 438 |
# b. server start will result in ER_LOG_WARN_PRIVILEGE_CHECKS_USER_CORRUPT. |
| 439 |
--let $debug_point = simulate_priv_check_username_above_limit |
| 440 |
--let $slave_server_num = 2 |
| 441 |
--source $MYSQL_TMP_DIR/restart_slave_with_debug_point.inc |
| 442 |
--source $MYSQL_TMP_DIR/assert_default_channel_invalid_config_with_file_repo.inc |
| 443 |
--source include/remove_debug_point.inc |
| 444 |
# c. SLAVE START will result in failure due to invalid config. |
| 445 |
--error ER_REPLICA_AM_INIT_REPOSITORY |
| 446 |
START SLAVE FOR CHANNEL ""; |
| 447 |
|
| 448 |
# Restore the correct channel config after error test case. |
| 449 |
RESET SLAVE FOR CHANNEL ""; |
| 450 |
CHANGE REPLICATION SOURCE TO SOURCE_HOST="localhost", SOURCE_PORT=10, PRIVILEGE_CHECKS_USER='replication_applier'@'localhost'; |
| 451 |
|
| 452 |
--echo # |
| 453 |
--echo # TC.E.F2: privilege_checks_hostname has more than 255 length. |
| 454 |
--echo # |
| 455 |
# a. CHANGE MASTER will result in ER_CLIENT_PRIVILEGE_CHECKS_USER_CORRUPT. |
| 456 |
--error ER_WRONG_STRING_LENGTH |
| 457 |
CHANGE REPLICATION SOURCE TO SOURCE_HOST="localhost", SOURCE_PORT=12, PRIVILEGE_CHECKS_USER='replication_applier'@'replication_privilege_checks_hostname_more_than_255_replication_privilege_checks_hostname_more_than_255_replication_privilege_checks_hostname_more_than_255_replication_privilege_checks_hostname_more_than_255_replication_privilege_checks_hostname_more_than255' FOR CHANNEL "" ; |
| 458 |
# b. server start will result in ER_LOG_WARN_PRIVILEGE_CHECKS_USER_CORRUPT. |
| 459 |
--let $debug_point = simulate_priv_check_hostname_above_limit |
| 460 |
--source $MYSQL_TMP_DIR/restart_slave_with_debug_point.inc |
| 461 |
--source $MYSQL_TMP_DIR/assert_default_channel_invalid_config_with_file_repo.inc |
| 462 |
--source include/remove_debug_point.inc |
| 463 |
# c. SLAVE START will result in failure due to invalid config. |
| 464 |
--error ER_REPLICA_AM_INIT_REPOSITORY |
| 465 |
START SLAVE FOR CHANNEL ""; |
| 466 |
|
| 467 |
--let $debug_point = |
| 468 |
# Restore the correct channel config after error test case. |
| 469 |
RESET SLAVE FOR CHANNEL ""; |
| 470 |
CHANGE REPLICATION SOURCE TO SOURCE_HOST="localhost", SOURCE_PORT=10, PRIVILEGE_CHECKS_USER='replication_applier'@'localhost'; |
| 471 |
|
| 472 |
--echo # |
| 473 |
--echo # TC.E.F3: privilege_checks_hostname has @. |
| 474 |
--echo # |
| 475 |
# a. CHANGE MASTER will result in ER_UNKNOWN_ERROR. |
| 476 |
--error ER_UNKNOWN_ERROR |
| 477 |
CHANGE REPLICATION SOURCE TO SOURCE_HOST="localhost", SOURCE_PORT=12, PRIVILEGE_CHECKS_USER='replication_applier'@'l@calhost' FOR CHANNEL "" ; |
| 478 |
# b. server start will result in ER_LOG_WARN_PRIVILEGE_CHECKS_USER_CORRUPT. |
| 479 |
--let $sub_testcase = host_name_has_@ |
| 480 |
--let $slave_server_num = 2 |
| 481 |
--let $rpl_server_restart_parameters = --skip_replica_start |
| 482 |
--source extra/rpl_tests/restart_slave_with_custom_relaylog_repo_file.inc |
| 483 |
--let $priv_checks_username = replication_applier |
| 484 |
--let $priv_checks_hostname = l@calhost |
| 485 |
--source $MYSQL_TMP_DIR/verify_priv_check_user_config_in_repo_file.inc |
| 486 |
--source $MYSQL_TMP_DIR/assert_default_channel_invalid_config_with_file_repo.inc |
| 487 |
# c. SLAVE START will result in failure due to invalid config. |
| 488 |
--error ER_REPLICA_AM_INIT_REPOSITORY |
| 489 |
START SLAVE FOR CHANNEL ""; |
| 490 |
|
| 491 |
# Restore the correct channel config after error test case. |
| 492 |
RESET SLAVE FOR CHANNEL ""; |
| 493 |
CHANGE REPLICATION SOURCE TO SOURCE_HOST="localhost", SOURCE_PORT=10, PRIVILEGE_CHECKS_USER='replication_applier'@'localhost'; |
| 494 |
|
| 495 |
--echo # |
| 496 |
--echo # TC.E.F5. privilege_checks_username is anonymous. |
| 497 |
--echo # |
| 498 |
# a. CHANGE MASTER will result in ER_CLIENT_PRIVILEGE_CHECKS_USER_CANNOT_BE_ANONYMOUS. |
| 499 |
--error ER_CLIENT_PRIVILEGE_CHECKS_USER_CANNOT_BE_ANONYMOUS |
| 500 |
CHANGE REPLICATION SOURCE TO SOURCE_HOST="localhost", SOURCE_PORT=12, PRIVILEGE_CHECKS_USER=''@'localhost' FOR CHANNEL "" ; |
| 501 |
# b. server start will result in ER_LOG_WARN_PRIVILEGE_CHECKS_USER_CORRUPT. |
| 502 |
--let $sub_testcase = anonymous_user |
| 503 |
--let $slave_server_num = 2 |
| 504 |
--let $rpl_server_restart_parameters = --skip_replica_start |
| 505 |
--source extra/rpl_tests/restart_slave_with_custom_relaylog_repo_file.inc |
| 506 |
--source $MYSQL_TMP_DIR/assert_default_channel_invalid_config_with_file_repo.inc |
| 507 |
# c. SLAVE START will result in failure due to invalid config. |
| 508 |
--error ER_REPLICA_AM_INIT_REPOSITORY |
| 509 |
START SLAVE FOR CHANNEL ""; |
| 510 |
|
| 511 |
# Restore the correct channel config after error test case. |
| 512 |
RESET SLAVE FOR CHANNEL ""; |
| 513 |
CHANGE REPLICATION SOURCE TO SOURCE_HOST="localhost", SOURCE_PORT=10, PRIVILEGE_CHECKS_USER='replication_applier'@'localhost'; |
| 514 |
|
| 515 |
--echo # |
| 516 |
--echo # TC.E.F6. privilege_checks_user is a non existent user. |
| 517 |
--echo # |
| 518 |
# a. CHANGE MASTER will result in |
| 519 |
# ER_CLIENT_PRIVILEGE_CHECKS_USER_DOES_NOT_EXIST. |
| 520 |
--error ER_CLIENT_PRIVILEGE_CHECKS_USER_DOES_NOT_EXIST |
| 521 |
CHANGE REPLICATION SOURCE TO SOURCE_HOST="localhost", SOURCE_PORT=12, PRIVILEGE_CHECKS_USER='replication_applier_nonexist'@'localhost' FOR CHANNEL "" ; |
| 522 |
# b. server start will result in |
| 523 |
# ER_LOG_WARN_PRIVILEGE_CHECKS_USER_DOES_NOT_EXIST. |
| 524 |
--let $sub_testcase = nonexist_user |
| 525 |
--let $slave_server_num = 2 |
| 526 |
--let $rpl_server_restart_parameters = --skip_replica_start |
| 527 |
--source extra/rpl_tests/restart_slave_with_custom_relaylog_repo_file.inc |
| 528 |
--let $priv_checks_username = replication_applier_nonexist |
| 529 |
--let $priv_checks_hostname = localhost |
| 530 |
--source $MYSQL_TMP_DIR/verify_priv_check_user_config_in_repo_file.inc |
| 531 |
--source $MYSQL_TMP_DIR/assert_default_channel_invalid_config_with_file_repo.inc |
| 532 |
# c. SLAVE START will result in failure due to invalid config. |
| 533 |
--error ER_REPLICA_AM_INIT_REPOSITORY |
| 534 |
START SLAVE FOR CHANNEL ""; |
| 535 |
|
| 536 |
# Restore the correct channel config after error test case. |
| 537 |
RESET SLAVE FOR CHANNEL ""; |
| 538 |
CHANGE REPLICATION SOURCE TO SOURCE_HOST="localhost", SOURCE_PORT=10, PRIVILEGE_CHECKS_USER='replication_applier'@'localhost'; |
| 539 |
|
| 540 |
--let $assert_text = Found 4 warning in the error log |
| 541 |
--let $assert_file = $MYSQLTEST_VARDIR/tmp/rpl_log_info_repository_persistence.2.err |
| 542 |
--let $assert_select = \[Warning\] \[[^]]*\] \[Repl\] Replica SQL for channel '': Invalid, corrupted PRIVILEGE_CHECKS_USER was found.* |
| 543 |
--let $assert_count = 4 |
| 544 |
--source include/assert_grep.inc |
| 545 |
|
| 546 |
--let $assert_text = Found 1 warning in the error log |
| 547 |
--let $assert_file = $MYSQLTEST_VARDIR/tmp/rpl_log_info_repository_persistence.2.err |
| 548 |
--let $assert_select = \[Warning\] \[[^]]*\] \[Repl\] Replica SQL for channel '': PRIVILEGE_CHECKS_USER for replication channel '' was set to `replication_applier_nonexist`@`localhost`, but this is not an existing user |
| 549 |
--let $assert_count = 1 |
| 550 |
--source include/assert_grep.inc |
| 551 |
|
| 552 |
# Restart the slave with relay-log-info-repository=TABLE |
| 553 |
# The debug point tests the execution flow where isn't nullptr |
| 554 |
# that is being passed to set_info but a variable with nullptr value. |
| 555 |
--echo # |
| 556 |
--echo # Restart slave with TABLE repository to test with privilege_checks_user config. |
| 557 |
--echo # |
| 558 |
--let $rpl_server_number = 2 |
| 559 |
--let $rpl_server_parameters = --relay-log-info-repository=TABLE --debug=d,simulate_priv_check_user_nullptr_t |
| 560 |
--let $explicit_default_wait_counter = 15000 |
| 561 |
--source include/rpl_restart_server.inc |
| 562 |
|
| 563 |
# verify (privilege_checks_username, privilege_checks_hostname), and |
| 564 |
# privilege_checks_user for default channel in mysql.slave_relay_log_info, |
| 565 |
# and performance_schema.replication_applier_configuration. There will be |
| 566 |
# one entry for default channel. |
| 567 |
--let $num_channels = 1 |
| 568 |
--source $MYSQL_TMP_DIR/assert_config_entry_count_with_table_repo.inc |
| 569 |
--let $channel = "" |
| 570 |
--let $priv_chks_user_expected_value = 'replication_applier'@'localhost' |
| 571 |
--let $priv_chks_username_expected_value = replication_applier |
| 572 |
--let $priv_chks_hostname_expected_value = localhost |
| 573 |
--source $MYSQL_TMP_DIR/assert_channel_config_with_table_repo.inc |
| 574 |
|
| 575 |
--echo # |
| 576 |
--echo # TC.P.T1: CHANGE MASTER sets the PRIVILEGE_CHECKS_USER correctly. |
| 577 |
--echo # |
| 578 |
# 1. create two channels ch1 and ch2 when slave is configured with TABLE type |
| 579 |
# repo. "ch1" has not PRIVILEGE_CHECKS_USER, "ch2" has |
| 580 |
# 'replication_applier'@'localhost' as PRIVILEGE_CHECK_USER. |
| 581 |
CHANGE REPLICATION SOURCE TO SOURCE_HOST="localhost", SOURCE_PORT=11, PRIVILEGE_CHECKS_USER=NULL FOR CHANNEL "ch1"; |
| 582 |
CHANGE REPLICATION SOURCE TO SOURCE_HOST="localhost", SOURCE_PORT=12, PRIVILEGE_CHECKS_USER='replication_applier'@'localhost' FOR CHANNEL "ch2" ; |
| 583 |
FLUSH RELAY LOGS FOR CHANNEL "ch1"; |
| 584 |
FLUSH RELAY LOGS FOR CHANNEL "ch2"; |
| 585 |
# 2. verify that there are three channel entries in both pfs and |
| 586 |
# slave_relay_log_info tables. |
| 587 |
--let $num_channels = 3 |
| 588 |
--source $MYSQL_TMP_DIR/assert_config_entry_count_with_table_repo.inc |
| 589 |
# 3. verify that "ch1" and "ch2" have expected values in |
| 590 |
# pfs and slave_relay_log_info tables. |
| 591 |
--let $channel = "ch1" |
| 592 |
--let $priv_chks_user_expected_value = NULL |
| 593 |
--let $priv_chks_username_expected_value = NULL |
| 594 |
--let $priv_chks_hostname_expected_value = NULL |
| 595 |
--source $MYSQL_TMP_DIR/assert_channel_config_with_table_repo.inc |
| 596 |
|
| 597 |
--let $channel = "ch2" |
| 598 |
--let $priv_chks_user_expected_value = 'replication_applier'@'localhost' |
| 599 |
--let $priv_chks_username_expected_value = replication_applier |
| 600 |
--let $priv_chks_hostname_expected_value = localhost |
| 601 |
--source $MYSQL_TMP_DIR/assert_channel_config_with_table_repo.inc |
| 602 |
|
| 603 |
--echo # |
| 604 |
--echo # TC.P.T2: PRIVILEGE_CHECKS_USER persists after restarting the server. |
| 605 |
--echo # |
| 606 |
# 1. restart the slave server. |
| 607 |
--let $rpl_server_number = 2 |
| 608 |
--let $rpl_server_parameters = --relay-log-info-repository=TABLE |
| 609 |
--let $explicit_default_wait_counter = 15000 |
| 610 |
--source include/rpl_restart_server.inc |
| 611 |
# 2. verify that there are three channel entries in both pfs and |
| 612 |
# slave_relay_log_info tables. |
| 613 |
--let $num_channels = 3 |
| 614 |
--source $MYSQL_TMP_DIR/assert_config_entry_count_with_table_repo.inc |
| 615 |
# 3. verify that "ch1" and "ch2" retained the values in |
| 616 |
# pfs and slave_relay_log_info tables after restart. |
| 617 |
--let $channel = "ch1" |
| 618 |
--let $priv_chks_user_expected_value = NULL |
| 619 |
--let $priv_chks_username_expected_value = NULL |
| 620 |
--let $priv_chks_hostname_expected_value = NULL |
| 621 |
--source $MYSQL_TMP_DIR/assert_channel_config_with_table_repo.inc |
| 622 |
|
| 623 |
--let $channel = "ch2" |
| 624 |
--let $priv_chks_user_expected_value = 'replication_applier'@'localhost' |
| 625 |
--let $priv_chks_username_expected_value = replication_applier |
| 626 |
--let $priv_chks_hostname_expected_value = localhost |
| 627 |
--source $MYSQL_TMP_DIR/assert_channel_config_with_table_repo.inc |
| 628 |
|
| 629 |
--echo # |
| 630 |
--echo # TC.P.T3: RESET SLAVE should keep value of PRIVILEGE_CHECKS_USER. |
| 631 |
--echo # |
| 632 |
|
| 633 |
# 1. reset slave for channel "". |
| 634 |
RESET SLAVE FOR CHANNEL ""; |
| 635 |
# 2. verify that slave_relay_log_info table and pfs have 3 records. |
| 636 |
--let $assert_text = Check that mysql.slave_relay_log_info has 2 entries for 2 channels |
| 637 |
--let $assert_cond = [SELECT COUNT(*) FROM mysql.slave_relay_log_info] = 3 |
| 638 |
--source include/assert.inc |
| 639 |
|
| 640 |
--let $assert_text = Check that performance_schema.replication_applier_configuration has 3 entries for 3 channels |
| 641 |
--let $assert_cond = [SELECT COUNT(*) FROM performance_schema.replication_applier_configuration] = 3 |
| 642 |
--source include/assert.inc |
| 643 |
|
| 644 |
# 3. verify that default channel has entry in pfs table. |
| 645 |
# Also verify that "ch1" and "ch2" kept values in |
| 646 |
# pfs and slave_relay_log_info tables after reset slave for default channel. |
| 647 |
--let $priv_chks_user = `SELECT COUNT(*) FROM performance_schema.replication_applier_configuration WHERE CHANNEL_NAME="" AND PRIVILEGE_CHECKS_USER="'replication_applier'@'localhost'"` |
| 648 |
--let $assert_text = Check that priv_chks_user for channel "" is correct |
| 649 |
--let $assert_cond = $priv_chks_user = 1 |
| 650 |
--source include/assert.inc |
| 651 |
|
| 652 |
--let $channel = "ch1" |
| 653 |
--let $priv_chks_user_expected_value = NULL |
| 654 |
--let $priv_chks_username_expected_value = NULL |
| 655 |
--let $priv_chks_hostname_expected_value = NULL |
| 656 |
--source $MYSQL_TMP_DIR/assert_channel_config_with_table_repo.inc |
| 657 |
|
| 658 |
--let $channel = "ch2" |
| 659 |
--let $priv_chks_user_expected_value = 'replication_applier'@'localhost' |
| 660 |
--let $priv_chks_username_expected_value = replication_applier |
| 661 |
--let $priv_chks_hostname_expected_value = localhost |
| 662 |
--source $MYSQL_TMP_DIR/assert_channel_config_with_table_repo.inc |
| 663 |
|
| 664 |
# removing all the other channel except "ch1", otherwise all the other channel |
| 665 |
# config processing will be erred due to debug points. |
| 666 |
RESET SLAVE ALL FOR CHANNEL ""; |
| 667 |
RESET SLAVE ALL FOR CHANNEL "ch2"; |
| 668 |
|
| 669 |
STOP SLAVE FOR CHANNEL "ch1"; |
| 670 |
--let $channel = "ch1" |
| 671 |
|
| 672 |
--echo # |
| 673 |
--echo # TC.E.T1: privilege_checks_username has more than 32 length. |
| 674 |
--echo # |
| 675 |
# a. CHANGE MASTER will result in ER_CLIENT_PRIVILEGE_CHECKS_USER_CORRUPT. |
| 676 |
--error ER_WRONG_STRING_LENGTH |
| 677 |
CHANGE REPLICATION SOURCE TO SOURCE_HOST="localhost", SOURCE_PORT=10, PRIVILEGE_CHECKS_USER='repli_priv_checks_user_more_than_32'@'localhost' FOR CHANNEL "ch1"; |
| 678 |
# b. server start will result in ER_LOG_WARN_PRIVILEGE_CHECKS_USER_CORRUPT. |
| 679 |
--let $debug_point = simulate_priv_check_username_above_limit |
| 680 |
--let $priv_chks_username = "repl_priv_chcks_usr_more_than_32" |
| 681 |
--let $priv_chks_hostname = "localhost" |
| 682 |
--source $MYSQL_TMP_DIR/assert_channel_invalid_config_update_of_table_repo_entry.inc |
| 683 |
--source include/remove_debug_point.inc |
| 684 |
# c. SLAVE START will result in failure due to invalid config. |
| 685 |
--error ER_REPLICA_AM_INIT_REPOSITORY |
| 686 |
START SLAVE FOR CHANNEL "ch1"; |
| 687 |
|
| 688 |
# Restore the correct channel config after error test case. |
| 689 |
RESET SLAVE FOR CHANNEL "ch1"; |
| 690 |
CHANGE REPLICATION SOURCE TO SOURCE_HOST="localhost", SOURCE_PORT=11 FOR CHANNEL "ch1"; |
| 691 |
|
| 692 |
--echo # |
| 693 |
--echo # TC.E.T2: privilege_checks_hostname has more than 255 length. |
| 694 |
--echo # |
| 695 |
# a. CHANGE MASTER will result in ER_CLIENT_PRIVILEGE_CHECKS_USER_CORRUPT. |
| 696 |
--error ER_WRONG_STRING_LENGTH |
| 697 |
CHANGE REPLICATION SOURCE TO SOURCE_HOST="localhost", SOURCE_PORT=12, PRIVILEGE_CHECKS_USER='replication_applier'@'replication_privilege_checks_hostname_more_than_255_replication_privilege_checks_hostname_more_than_255_replication_privilege_checks_hostname_more_than_255_replication_privilege_checks_hostname_more_than_255_replication_privilege_checks_hostname_more_than255' FOR CHANNEL "ch1" ; |
| 698 |
# b. server start will result in ER_LOG_WARN_PRIVILEGE_CHECKS_USER_CORRUPT. |
| 699 |
--let $debug_point = simulate_priv_check_hostname_above_limit |
| 700 |
--let $priv_chks_username = "replication_applier" |
| 701 |
--let $priv_chks_hostname = "replication_applier_hostname_more_than_255" |
| 702 |
--source $MYSQL_TMP_DIR/assert_channel_invalid_config_update_of_table_repo_entry.inc |
| 703 |
--source include/remove_debug_point.inc |
| 704 |
# c. SLAVE START will result in failure due to invalid config. |
| 705 |
--error ER_REPLICA_AM_INIT_REPOSITORY |
| 706 |
START SLAVE FOR CHANNEL "ch1"; |
| 707 |
|
| 708 |
--let $debug_point = |
| 709 |
# Restore the correct channel config after error test case. |
| 710 |
RESET SLAVE FOR CHANNEL "ch1"; |
| 711 |
CHANGE REPLICATION SOURCE TO SOURCE_HOST="localhost", SOURCE_PORT=11 FOR CHANNEL "ch1"; |
| 712 |
|
| 713 |
--echo # |
| 714 |
--echo # TC.E.T3: privilege_checks_hostname has @. |
| 715 |
--echo # |
| 716 |
# a. CHANGE MASTER will result in ER_UNKNOWN_ERROR. |
| 717 |
--error ER_UNKNOWN_ERROR |
| 718 |
CHANGE REPLICATION SOURCE TO SOURCE_HOST="localhost", SOURCE_PORT=12, PRIVILEGE_CHECKS_USER='replication_applier'@'l@calhost' FOR CHANNEL "ch1" ; |
| 719 |
# b. server start will result in ER_LOG_WARN_PRIVILEGE_CHECKS_USER_CORRUPT. |
| 720 |
--let $priv_chks_username = 'replication_applier' |
| 721 |
--let $priv_chks_hostname = 'l@calhost' |
| 722 |
--source $MYSQL_TMP_DIR/assert_channel_invalid_config_update_of_table_repo_entry.inc |
| 723 |
# c. SLAVE START will result in failure due to invalid config. |
| 724 |
--error ER_REPLICA_AM_INIT_REPOSITORY |
| 725 |
START SLAVE FOR CHANNEL "ch1"; |
| 726 |
|
| 727 |
# Restore the correct channel config after error test case. |
| 728 |
RESET SLAVE FOR CHANNEL "ch1"; |
| 729 |
CHANGE REPLICATION SOURCE TO SOURCE_HOST="localhost", SOURCE_PORT=11 FOR CHANNEL "ch1"; |
| 730 |
|
| 731 |
--echo # |
| 732 |
--echo # TC.E.T4. privilege_checks_username is NULL and |
| 733 |
# privilege_checks_hostname is not NULL. |
| 734 |
--echo # |
| 735 |
# a. server start will result in ER_LOG_WARN_PRIVILEGE_CHECKS_USER_CORRUPT. |
| 736 |
--let $priv_chks_username = NULL |
| 737 |
--let $priv_chks_hostname = "localhost" |
| 738 |
--source $MYSQL_TMP_DIR/assert_channel_invalid_config_update_of_table_repo_entry.inc |
| 739 |
# b. SLAVE START will result in failure due to invalid config. |
| 740 |
--error ER_REPLICA_AM_INIT_REPOSITORY |
| 741 |
START SLAVE FOR CHANNEL "ch1"; |
| 742 |
|
| 743 |
# Restore the correct channel config after error test case. |
| 744 |
RESET SLAVE FOR CHANNEL "ch1"; |
| 745 |
CHANGE REPLICATION SOURCE TO SOURCE_HOST="localhost", SOURCE_PORT=11 FOR CHANNEL "ch1"; |
| 746 |
|
| 747 |
--echo # |
| 748 |
--echo # TC.E.T5. privilege_checks_username is anonymous. |
| 749 |
--echo # |
| 750 |
# a. CHANGE MASTER will result in |
| 751 |
# ER_CLIENT_PRIVILEGE_CHECKS_USER_CANNOT_BE_ANONYMOUS. |
| 752 |
--error ER_CLIENT_PRIVILEGE_CHECKS_USER_CANNOT_BE_ANONYMOUS |
| 753 |
CHANGE REPLICATION SOURCE TO SOURCE_HOST="localhost", SOURCE_PORT=12, PRIVILEGE_CHECKS_USER=''@'localhost' FOR CHANNEL "ch1" ; |
| 754 |
# b. server start will result in ER_LOG_WARN_PRIVILEGE_CHECKS_USER_CORRUPT. |
| 755 |
--let $priv_chks_username = "" |
| 756 |
--let $priv_chks_hostname = "localhost" |
| 757 |
--source $MYSQL_TMP_DIR/assert_channel_invalid_config_update_of_table_repo_entry.inc |
| 758 |
# c. SLAVE START will result in failure due to invalid config. |
| 759 |
--error ER_REPLICA_AM_INIT_REPOSITORY |
| 760 |
START SLAVE FOR CHANNEL "ch1"; |
| 761 |
|
| 762 |
# Restore the correct channel config after error test case. |
| 763 |
RESET SLAVE FOR CHANNEL "ch1"; |
| 764 |
CHANGE REPLICATION SOURCE TO SOURCE_HOST="localhost", SOURCE_PORT=11 FOR CHANNEL "ch1"; |
| 765 |
|
| 766 |
--echo # |
| 767 |
--echo # TC.E.T6. privilege_checks_user is a non existent user. |
| 768 |
--echo # |
| 769 |
# a. CHANGE MASTER will result in ER_CLIENT_PRIVILEGE_CHECKS_USER_DOES_NOT_EXIST. |
| 770 |
--error ER_CLIENT_PRIVILEGE_CHECKS_USER_DOES_NOT_EXIST |
| 771 |
CHANGE REPLICATION SOURCE TO SOURCE_HOST="localhost", SOURCE_PORT=12, PRIVILEGE_CHECKS_USER='replication_applier_nonexist'@'localhost' FOR CHANNEL "ch1" ; |
| 772 |
# b. server start will result in ER_LOG_WARN_PRIVILEGE_CHECKS_USER_DOES_NOT_EXIST. |
| 773 |
--let $priv_chks_username = "replication_applier_nonexist" |
| 774 |
--let $priv_chks_hostname = "localhost" |
| 775 |
--source $MYSQL_TMP_DIR/assert_channel_invalid_config_update_of_table_repo_entry.inc |
| 776 |
# c. SLAVE START will result in failure due to invalid config. |
| 777 |
--error ER_REPLICA_AM_INIT_REPOSITORY |
| 778 |
START SLAVE FOR CHANNEL "ch1"; |
| 779 |
|
| 780 |
# Restore the correct channel config after error test case. |
| 781 |
RESET SLAVE FOR CHANNEL "ch1"; |
| 782 |
CHANGE REPLICATION SOURCE TO SOURCE_HOST="127.0.0.1", SOURCE_PORT=11 FOR CHANNEL "ch1"; |
| 783 |
|
| 784 |
--let $assert_text = Found 5 warning in the error log |
| 785 |
--let $assert_file = $MYSQLTEST_VARDIR/tmp/rpl_log_info_repository_persistence.2.err |
| 786 |
--let $assert_select = \[Warning\] \[[^]]*\] \[Repl\] Replica SQL for channel 'ch1': Invalid, corrupted PRIVILEGE_CHECKS_USER was found.* |
| 787 |
--let $assert_count = 5 |
| 788 |
--source include/assert_grep.inc |
| 789 |
|
| 790 |
--let $assert_text = Found 1 warning in the error log |
| 791 |
--let $assert_file = $MYSQLTEST_VARDIR/tmp/rpl_log_info_repository_persistence.2.err |
| 792 |
--let $assert_select = \[Warning\] \[[^]]*\] \[Repl\] Replica SQL for channel 'ch1': PRIVILEGE_CHECKS_USER for replication channel 'ch1' was set to `replication_applier_nonexist`@`localhost`, but this is not an existing user |
| 793 |
--let $assert_count = 1 |
| 794 |
--source include/assert_grep.inc |
| 795 |
|
| 796 |
DROP USER 'replication_applier'@'localhost'; |
| 797 |
|
| 798 |
--remove_file $MYSQL_TMP_DIR/assert_default_channel_config_with_file_repo.inc |
| 799 |
--remove_file $MYSQL_TMP_DIR/restart_slave_with_debug_point.inc |
| 800 |
--remove_file $MYSQL_TMP_DIR/verify_priv_check_user_config_in_repo_file.inc |
| 801 |
--remove_file $MYSQL_TMP_DIR/assert_default_channel_invalid_config_with_file_repo.inc |
| 802 |
--remove_file $MYSQL_TMP_DIR/assert_config_entry_count_with_table_repo.inc |
| 803 |
--remove_file $MYSQL_TMP_DIR/assert_channel_config_with_table_repo.inc |
| 804 |
--remove_file $MYSQL_TMP_DIR/assert_channel_invalid_config_update_of_table_repo_entry.inc |
| 805 |
|
| 806 |
--source include/stop_slave.inc |
| 807 |
RESET REPLICA ALL; |
| 808 |
--connection slave |
| 809 |
SET @@global.relay_log_info_repository=FILE; |
| 810 |
--replace_result $MASTER_MYPORT MASTER_MYPORT |
| 811 |
--eval CHANGE REPLICATION SOURCE TO SOURCE_USER='root', SOURCE_HOST="127.0.0.1", SOURCE_PORT=$MASTER_MYPORT; |
| 812 |
--source include/start_slave.inc |
| 813 |
--let $rpl_channel_name= |
| 814 |
--let $rpl_skip_sync= 1 |
| 815 |
source include/rpl_end.inc; |