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