| 1 |
################################################################################ |
| 2 |
# This test verifies that the CHANGE MASTER command will only accept |
| 3 |
# MASTER_USER and MASTER_PASSWORD as valid values for the recovery channel. |
| 4 |
# All other options for the CHANGE MASTER will cause an error. |
| 5 |
# |
| 6 |
# Test: |
| 7 |
# 0. The test requires two servers: M1 and M2. |
| 8 |
# 1. Create a user on M1 to be used by the recovery channel. Bootstrap and start |
| 9 |
# group on M1. |
| 10 |
# 2. Add some data for recovery. |
| 11 |
# 3. On M2, CHANGE MASTER with options apart from the MASTER_USER and |
| 12 |
# MASTER_PASSWORD will cause error. |
| 13 |
# 4. MASTER_PASSWORD for the CHANGE MASTER command will not be logged in the |
| 14 |
# error log. |
| 15 |
# 5. The password value is not logged in the error log. |
| 16 |
# 6. CHANGE MASTER with valid options will work fine. |
| 17 |
# 7. Ensuring the the two members are online. |
| 18 |
# 8. Clean up. |
| 19 |
################################################################################ |
| 20 |
|
| 21 |
--source include/have_group_replication_plugin.inc |
| 22 |
--let $rpl_skip_group_replication_start= 1 |
| 23 |
--source include/group_replication.inc |
| 24 |
|
| 25 |
# Start group replication on server1 |
| 26 |
|
| 27 |
--let $rpl_connection_name= server1 |
| 28 |
--source include/rpl_connection.inc |
| 29 |
|
| 30 |
--echo # Creating a connection on the first server to be used by the recovery channel |
| 31 |
SET sql_log_bin=0; |
| 32 |
CREATE USER 'manish'@'%' IDENTIFIED BY 'rpl'; |
| 33 |
GRANT REPLICATION SLAVE ON *.* TO 'manish'@'%'; |
| 34 |
GRANT GROUP_REPLICATION_STREAM ON *.* TO 'manish'@'%'; |
| 35 |
FLUSH PRIVILEGES; |
| 36 |
SET sql_log_bin=1; |
| 37 |
|
| 38 |
--source include/start_and_bootstrap_group_replication.inc |
| 39 |
|
| 40 |
# Add some data for recovery |
| 41 |
CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB; |
| 42 |
INSERT INTO t1 VALUES (1); |
| 43 |
|
| 44 |
--let $rpl_connection_name= server2 |
| 45 |
--source include/rpl_connection.inc |
| 46 |
|
| 47 |
--echo # CHANGE MASTER with options apart from the MASTER_USER and |
| 48 |
--echo # MASTER_PASSWORD will cause error. |
| 49 |
--error ER_REPLICA_CHANNEL_OPERATION_NOT_ALLOWED |
| 50 |
CHANGE REPLICATION SOURCE TO SOURCE_USER='MANISH', SOURCE_PASSWORD='abc_manish_abc', SOURCE_PORT=13000 FOR CHANNEL 'group_replication_recovery'; |
| 51 |
|
| 52 |
--let $assert_text=No new user is created after the execution of the change master |
| 53 |
--let $assert_cond= `SELECT COUNT(*) = 0 FROM mysql.slave_master_info WHERE User_name LIKE 'MANISH'` |
| 54 |
--source include/assert.inc |
| 55 |
|
| 56 |
--echo # MASTER_PASSWORD value for the CHANGE MASTER command will not be logged in the error log. |
| 57 |
--let $grep_file=$MYSQLTEST_VARDIR/tmp/group_replication_recovery_change_master.err |
| 58 |
--let $grep_pattern= source_password |
| 59 |
--let $grep_output= print_count |
| 60 |
--source include/grep_pattern.inc |
| 61 |
|
| 62 |
--echo # The password value 'unique_password' is not logged in the error log. |
| 63 |
--let $grep_file=$MYSQLTEST_VARDIR/tmp/group_replication_recovery_change_master.err |
| 64 |
--let $grep_pattern= abc_manish_abc |
| 65 |
--let $grep_output= print_count |
| 66 |
--source include/grep_pattern.inc |
| 67 |
|
| 68 |
--echo # Second CHANGE MASTER with valid options will work fine. |
| 69 |
--disable_warnings |
| 70 |
CHANGE REPLICATION SOURCE TO SOURCE_USER='manish', SOURCE_PASSWORD='rpl' FOR CHANNEL 'group_replication_recovery'; |
| 71 |
--enable_warnings |
| 72 |
|
| 73 |
--let $assert_text= A new user is created after the execution of the change master |
| 74 |
--let $assert_cond= `SELECT COUNT(*) = 1 FROM mysql.slave_master_info WHERE User_name LIKE 'manish'` |
| 75 |
--source include/assert.inc |
| 76 |
|
| 77 |
SET sql_log_bin=0; |
| 78 |
CREATE USER 'manish'@'%' IDENTIFIED BY 'rpl'; |
| 79 |
GRANT REPLICATION SLAVE ON *.* TO 'manish'@'%'; |
| 80 |
GRANT GROUP_REPLICATION_STREAM ON *.* TO 'manish'@'%'; |
| 81 |
FLUSH PRIVILEGES; |
| 82 |
SET sql_log_bin=1; |
| 83 |
|
| 84 |
--source include/start_group_replication.inc |
| 85 |
|
| 86 |
--echo # Ensuring the the two members are online. |
| 87 |
--connection server1 |
| 88 |
--let $group_replication_number_of_members= 2 |
| 89 |
--source include/gr_wait_for_number_of_members.inc |
| 90 |
--source include/rpl_sync.inc |
| 91 |
|
| 92 |
--let $diff_tables=server1:t1,server2:t1 |
| 93 |
--source include/diff_tables.inc |
| 94 |
|
| 95 |
# Cleanup |
| 96 |
DROP TABLE t1; |
| 97 |
SET sql_log_bin=0; |
| 98 |
DROP USER manish; |
| 99 |
SET sql_log_bin=1; |
| 100 |
|
| 101 |
--connection server2 |
| 102 |
SET sql_log_bin=0; |
| 103 |
DROP USER manish; |
| 104 |
SET sql_log_bin=1; |
| 105 |
|
| 106 |
--source include/group_replication_end.inc |