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
|
################################################################################
# This test verifies that the CHANGE MASTER command will only accept
# MASTER_USER and MASTER_PASSWORD as valid values for the recovery channel.
# All other options for the CHANGE MASTER will cause an error.
#
# Test:
# 0. The test requires two servers: M1 and M2.
# 1. Create a user on M1 to be used by the recovery channel. Bootstrap and start
# group on M1.
# 2. Add some data for recovery.
# 3. On M2, CHANGE MASTER with options apart from the MASTER_USER and
# MASTER_PASSWORD will cause error.
# 4. MASTER_PASSWORD for the CHANGE MASTER command will not be logged in the
# error log.
# 5. The password value is not logged in the error log.
# 6. CHANGE MASTER with valid options will work fine.
# 7. Ensuring the the two members are online.
# 8. Clean up.
################################################################################
--source include/have_group_replication_plugin.inc
--let $rpl_skip_group_replication_start= 1
--source include/group_replication.inc
# Start group replication on server1
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--echo # Creating a connection on the first server to be used by the recovery channel
SET sql_log_bin=0;
CREATE USER 'manish'@'%' IDENTIFIED BY 'rpl';
GRANT REPLICATION SLAVE ON *.* TO 'manish'@'%';
GRANT GROUP_REPLICATION_STREAM ON *.* TO 'manish'@'%';
FLUSH PRIVILEGES;
SET sql_log_bin=1;
--source include/start_and_bootstrap_group_replication.inc
# Add some data for recovery
CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--echo # CHANGE MASTER with options apart from the MASTER_USER and
--echo # MASTER_PASSWORD will cause error.
--error ER_REPLICA_CHANNEL_OPERATION_NOT_ALLOWED
CHANGE REPLICATION SOURCE TO SOURCE_USER='MANISH', SOURCE_PASSWORD='abc_manish_abc', SOURCE_PORT=13000 FOR CHANNEL 'group_replication_recovery';
--let $assert_text=No new user is created after the execution of the change master
--let $assert_cond= `SELECT COUNT(*) = 0 FROM mysql.slave_master_info WHERE User_name LIKE 'MANISH'`
--source include/assert.inc
--echo # MASTER_PASSWORD value for the CHANGE MASTER command will not be logged in the error log.
--let $grep_file=$MYSQLTEST_VARDIR/tmp/group_replication_recovery_change_master.err
--let $grep_pattern= source_password
--let $grep_output= print_count
--source include/grep_pattern.inc
--echo # The password value 'unique_password' is not logged in the error log.
--let $grep_file=$MYSQLTEST_VARDIR/tmp/group_replication_recovery_change_master.err
--let $grep_pattern= abc_manish_abc
--let $grep_output= print_count
--source include/grep_pattern.inc
--echo # Second CHANGE MASTER with valid options will work fine.
--disable_warnings
CHANGE REPLICATION SOURCE TO SOURCE_USER='manish', SOURCE_PASSWORD='rpl' FOR CHANNEL 'group_replication_recovery';
--enable_warnings
--let $assert_text= A new user is created after the execution of the change master
--let $assert_cond= `SELECT COUNT(*) = 1 FROM mysql.slave_master_info WHERE User_name LIKE 'manish'`
--source include/assert.inc
SET sql_log_bin=0;
CREATE USER 'manish'@'%' IDENTIFIED BY 'rpl';
GRANT REPLICATION SLAVE ON *.* TO 'manish'@'%';
GRANT GROUP_REPLICATION_STREAM ON *.* TO 'manish'@'%';
FLUSH PRIVILEGES;
SET sql_log_bin=1;
--source include/start_group_replication.inc
--echo # Ensuring the the two members are online.
--connection server1
--let $group_replication_number_of_members= 2
--source include/gr_wait_for_number_of_members.inc
--source include/rpl_sync.inc
--let $diff_tables=server1:t1,server2:t1
--source include/diff_tables.inc
# Cleanup
DROP TABLE t1;
SET sql_log_bin=0;
DROP USER manish;
SET sql_log_bin=1;
--connection server2
SET sql_log_bin=0;
DROP USER manish;
SET sql_log_bin=1;
--source include/group_replication_end.inc
|