-
Notifications
You must be signed in to change notification settings - Fork 4k
/
Copy pathgr_change_replication_source_hidden.inc
72 lines (56 loc) · 2.99 KB
/
gr_change_replication_source_hidden.inc
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
# This test verifies that the CHANGE REPLICATION SOURCE FOR recovery channel
# command is logged in the slow log, query_log and error log, but the password
# value is either masked with '<secret>' or is not logged.
#
--let $skip_recovery_configuration=1
--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/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 'unique_password';
GRANT REPLICATION SLAVE ON *.* TO 'manish'@'%';
CREATE USER 'internal_usr'@'%' IDENTIFIED BY 'unique_password';
GRANT GROUP_REPLICATION_STREAM ON *.* TO 'internal_usr'@'%';
FLUSH PRIVILEGES;
SET sql_log_bin=1;
--disable_warnings
CHANGE REPLICATION SOURCE TO SOURCE_USER='internal_usr', SOURCE_PASSWORD='unique_password' FOR CHANNEL 'group_replication_recovery';
--enable_warnings
SET @old_log_output= @@log_output;
SET GLOBAL log_output= 'TABLE';
TRUNCATE mysql.general_log;
--source include/start_and_bootstrap_group_replication.inc
--echo # CHANGE REPLICATION SOURCE with valid options will work fine and the password part will be masked with <secret>
--disable_warnings
CHANGE REPLICATION SOURCE TO SOURCE_USER='manish', SOURCE_PASSWORD='unique_password' FOR CHANNEL 'group_replication_recovery';
--enable_warnings
--echo # Since SOURCE_PASSWORD is not stored in the performance schema table
--echo # (performance_schema.replication_connection_configuration) it won't be visible.
--error ER_BAD_FIELD_ERROR
SELECT password FROM performance_schema.replication_connection_configuration;
--echo server1
--let $change_count= `SELECT COUNT(*) FROM mysql.general_log WHERE argument LIKE 'CHANGE REPLICATION SOURCE TO SOURCE_USER = \'manish\', SOURCE_PASSWORD = <secret> FOR CHANNEL \'group_replication_recovery\''`
--let $assert_cond= "$change_count" = 1
--let $assert_text= The CHANGE REPLICATION SOURCE TO is logged with the password value replaced with the keyword <secret>.
--source include/assert.inc
# Checking the default values for the User_name and User_password field.
--connection server2
--let $expected_value_user=`SELECT User_name FROM mysql.slave_master_info WHERE Channel_name LIKE 'group_replication_recovery'`
--let $expected_value_password=`SELECT User_password FROM mysql.slave_master_info WHERE Channel_name LIKE 'group_replication_recovery'`
--let $assert_text= The default values of the User_name and User_password are empty without a previous change replication source.
--let $assert_cond= "$expected_value_user" = "" AND "$expected_value_password"= ""
--source include/assert.inc
--connection server1
# Cleanup
RESET REPLICA ALL FOR CHANNEL 'group_replication_recovery';
SET sql_log_bin=0;
DROP USER manish;
DROP USER internal_usr;
SET sql_log_bin=1;
SET @@global.log_output= @old_log_output;
TRUNCATE TABLE mysql.general_log;
--source include/group_replication_end.inc