Debian Codegraph @

mysql-test/suite/group_replication/include/gr_change_master_hidden.inc

raw
1 # This test verifies that the CHANGE REPLICATION SOURCE FOR recovery channel
2 # command is logged in the slow log, query_log and error log, but the password
3 # value is either masked with '<secret>' or is not logged.
4 #
5
6 --let $skip_recovery_configuration=1
7 --source include/have_group_replication_plugin.inc
8 --let $rpl_skip_group_replication_start= 1
9 --source include/group_replication.inc
10
11 # Start group replication on server1
12
13 --let $rpl_connection_name= server1
14 --source include/rpl_connection.inc
15
16 --echo # Creating a connection on the first server to be used by the recovery channel
17 SET sql_log_bin=0;
18 CREATE USER 'manish'@'%' IDENTIFIED BY 'unique_password';
19 GRANT REPLICATION SLAVE ON *.* TO 'manish'@'%';
20
21 CREATE USER 'internal_usr'@'%' IDENTIFIED BY 'unique_password';
22 GRANT GROUP_REPLICATION_STREAM ON *.* TO 'internal_usr'@'%';
23 FLUSH PRIVILEGES;
24 SET sql_log_bin=1;
25
26 --disable_warnings
27 CHANGE MASTER TO MASTER_USER='internal_usr', MASTER_PASSWORD='unique_password' FOR CHANNEL 'group_replication_recovery';
28 --enable_warnings
29
30 SET @old_log_output= @@log_output;
31 SET GLOBAL log_output= 'TABLE';
32 TRUNCATE mysql.general_log;
33
34 --source include/start_and_bootstrap_group_replication.inc
35
36 --echo # CHANGE REPLICATION SOURCE with valid options will work fine and the password part will be masked with <secret>
37 --disable_warnings
38 CHANGE REPLICATION SOURCE TO SOURCE_USER='manish', SOURCE_PASSWORD='unique_password' FOR CHANNEL 'group_replication_recovery';
39 --enable_warnings
40
41 --echo # Since MASTER_PASSWORD is not stored in the performance schema table
42 --echo # (performance_schema.replication_connection_configuration) it won't be visible.
43 --error ER_BAD_FIELD_ERROR
44 SELECT password FROM performance_schema.replication_connection_configuration;
45
46 --echo server1
47 --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\''`
48 --let $assert_cond= "$change_count" = 1
49 --let $assert_text= The CHANGE REPLICATION SOURCE TO is logged with the password value replaced with the keyword <secret>.
50 --source include/assert.inc
51
52 # Checking the default values for the User_name and User_password field.
53
54 --connection server2
55
56 --let $expected_value_user=`SELECT User_name FROM mysql.slave_master_info WHERE Channel_name LIKE 'group_replication_recovery'`
57 --let $expected_value_password=`SELECT User_password FROM mysql.slave_master_info WHERE Channel_name LIKE 'group_replication_recovery'`
58 --let $assert_text= The default values of the User_name and User_password are empty without a previous change master.
59 --let $assert_cond= "$expected_value_user" = "" AND "$expected_value_password"= ""
60 --source include/assert.inc
61
62 --connection server1
63
64 # Cleanup
65 RESET REPLICA ALL FOR CHANNEL 'group_replication_recovery';
66 SET sql_log_bin=0;
67 DROP USER manish;
68 DROP USER internal_usr;
69 SET sql_log_bin=1;
70 SET @@global.log_output= @old_log_output;
71 TRUNCATE TABLE mysql.general_log;
72 --source include/group_replication_end.inc