Debian Codegraph @

mysql-test/suite/rpl/t/rpl_public_key.test

raw
1 # ==== Purpose ====
2 #
3 # Verify that changing Master_public_key in CHANGE SLAVE
4 # takes effect immedietly
5 #
6 # ==== Method ====
7 #
8 # We do the following steps:
9 # - Create a new replication user on master
10 # - Connect to slave and start replication as this user.
11 # - Verify that replication works
12 # - Stop slave
13 # - Change Master_public_key file on slave
14 # - Execute FLUSH PRIVILEGES on master
15 # - start slave and expect timeout
16
17 --echo #
18 --echo # Bug#27122947: RSA PUBLIC KEY GETS CACHED ON SLAVE
19 --echo # WHICH IS USED BY SUBSEQUENT LOGINS
20 --echo #
21
22 --source include/not_group_replication_plugin.inc
23 --source include/set_privilege_checks_user_as_system_user.inc
24 --let $rpl_privilege_checks_user_grant_option = 1
25 --source include/master-slave.inc
26
27 --echo ==== Create new replication user ====
28 --source include/rpl_connection_master.inc
29 CREATE USER u27122947 IDENTIFIED WITH 'caching_sha2_password' BY 'pwd';
30 GRANT REPLICATION SLAVE ON *.* TO u27122947;
31
32 --echo ==== Start using new replication user on slave ====
33 --source include/sync_slave_sql_with_master.inc
34 --source include/rpl_connection_slave.inc
35 --source include/stop_slave.inc
36 --replace_column 2 ###
37 --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
38 eval CHANGE REPLICATION SOURCE TO SOURCE_USER='u27122947', SOURCE_PASSWORD='pwd', SOURCE_PUBLIC_KEY_PATH='$MYSQL_TEST_DIR/std_data/rsa_public_key.pem';
39 --source include/start_slave.inc
40
41 --echo ==== Make sure that replication works ====
42 --source include/rpl_connection_master.inc
43 CREATE TABLE t1 (c1 INT);
44 INSERT INTO t1 VALUES (1);
45 --source include/sync_slave_sql_with_master.inc
46 --source include/rpl_connection_slave.inc
47 SELECT * FROM t1;
48
49 --echo ==== Stop slave and used empty values for master_public_key_path ====
50 --source include/rpl_connection_slave.inc
51 --source include/stop_slave.inc
52 --replace_column 2 ###
53 CHANGE REPLICATION SOURCE TO SOURCE_USER='u27122947', SOURCE_PASSWORD='pwd', SOURCE_PUBLIC_KEY_PATH='';
54
55 --echo ==== Remove cached password from master ====
56 --source include/rpl_connection_master.inc
57 FLUSH PRIVILEGES;
58 # Also update t1 to verify replication a later stage
59 INSERT INTO t1 VALUES (2);
60
61 --echo ==== Try START SLAVE on slave : I/O thread should throw error ====
62 --source include/rpl_connection_slave.inc
63 START SLAVE;
64 # 2061 : CR_AUTH_PLUGIN_ERR
65 --let $slave_io_errno= 2061
66 --let $slow_slave_io_error= 1
67 --source include/wait_for_slave_io_error.inc
68
69 --echo ==== Try setting correct public key ====
70 --source include/rpl_connection_slave.inc
71 --source include/stop_slave.inc
72 --replace_column 2 ###
73 --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
74 eval CHANGE REPLICATION SOURCE TO SOURCE_USER='u27122947', SOURCE_PASSWORD='pwd', SOURCE_PUBLIC_KEY_PATH='$MYSQL_TEST_DIR/std_data/rsa_public_key.pem';
75 --source include/start_slave.inc
76
77 --echo ==== Try setting master_public_key_path to '' ====
78 --source include/rpl_connection_slave.inc
79 --source include/stop_slave.inc
80 --replace_column 2 ###
81 CHANGE REPLICATION SOURCE TO SOURCE_USER='u27122947', SOURCE_PASSWORD='pwd', SOURCE_PUBLIC_KEY_PATH='';
82
83 --echo ==== IO thread should start without issues because password is still cached ====
84 --source include/start_slave.inc
85 --source include/rpl_connection_master.inc
86 --source include/sync_slave_sql_with_master.inc
87 SELECT * FROM t1;
88
89 --echo ==== Reset and cleanup ====
90 --source include/rpl_connection_slave.inc
91 --source include/stop_slave.inc
92 --replace_column 2 ####
93 CHANGE REPLICATION SOURCE TO SOURCE_USER = 'root', SOURCE_PASSWORD = '';
94 --let $rpl_only_running_threads= 1
95 --source include/rpl_reset.inc
96
97 --source include/rpl_connection_master.inc
98 DROP TABLE t1;
99 DROP USER u27122947;
100
101 --source include/sync_slave_sql_with_master.inc
102
103 --source include/rpl_end.inc
104 --source include/force_restart.inc