Debian Codegraph @

mysql-test/suite/group_replication/t/gr_change_master_not_replicated.test

raw
1 ################################################################################
2 # This test verifies that the CHANGE MASTER command is not logged in the binary
3 # log. Therefore it is not replicated as well.
4 #
5 # Test:
6 # 0. The test requires two servers: M1 and M2.
7 # 1. Create a user on M1 to be used by the recovery channel. Bootstrap
8 # GROUP on M1. Add some data for recovery.
9 # 2. Start GR on M2 post CHANGE MASTER with valid values. Grep for
10 # 'CHANGE MASTER' pattern in binary log data. Expect 0 count.
11 # 3. Grep for 'CHANGE MASTER' pattern in binary log of M1. Expect 0 count.
12 ################################################################################
13
14 --let $skip_recovery_configuration=1
15 --source include/have_group_replication_plugin.inc
16 --let $rpl_skip_group_replication_start= 1
17 --source include/group_replication.inc
18
19 # Start group replication on server1
20
21 --let $rpl_connection_name= server1
22 --source include/rpl_connection.inc
23
24 --echo # Creating a connection on the first server to be used by the recovery channel
25 SET sql_log_bin=0;
26 CREATE USER 'manish'@'%' IDENTIFIED BY 'rpl';
27 GRANT REPLICATION SLAVE ON *.* TO 'manish'@'%';
28 GRANT GROUP_REPLICATION_STREAM ON *.* TO 'manish'@'%';
29 FLUSH PRIVILEGES;
30 SET sql_log_bin=1;
31
32 --disable_warnings
33 CHANGE MASTER TO MASTER_USER='manish', MASTER_PASSWORD='rpl' FOR CHANNEL 'group_replication_recovery';
34 --enable_warnings
35
36 --source include/start_and_bootstrap_group_replication.inc
37
38 # Add some data for recovery
39 CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
40
41 --let $rpl_connection_name= server2
42 --source include/rpl_connection.inc
43
44 --echo # Second CHANGE MASTER with valid options will work fine.
45 --disable_warnings
46 CHANGE REPLICATION SOURCE TO SOURCE_USER='manish', SOURCE_PASSWORD='rpl' FOR CHANNEL 'group_replication_recovery';
47 --enable_warnings
48
49 SET sql_log_bin=0;
50 CREATE USER 'manish'@'%' IDENTIFIED BY 'rpl';
51 GRANT REPLICATION SLAVE ON *.* TO 'manish'@'%';
52 GRANT GROUP_REPLICATION_STREAM ON *.* TO 'manish'@'%';
53 FLUSH PRIVILEGES;
54 SET sql_log_bin=1;
55
56 --source include/start_group_replication.inc
57
58 --let $MYSQLD_DATADIR= `select @@datadir;`
59 --exec $MYSQL_BINLOG $MYSQLD_DATADIR/server-binary-log.000001 > $MYSQLTEST_VARDIR/tmp/change_master_server2.sql
60
61 --echo # Asserting that CHANGE MASTER is not logged in the binary log of the server 2.
62 --let $grep_file=$MYSQLTEST_VARDIR/tmp/change_master_server2.sql
63 --let $grep_pattern= CHANGE REPLICATION SOURCE
64 --let $grep_output= print_count
65 --source include/grep_pattern.inc
66
67 --echo # Ensuring the the two members are online.
68 --let $rpl_connection_name= server1
69 --source include/rpl_connection.inc
70
71 --let $group_replication_number_of_members= 2
72 --source include/gr_wait_for_number_of_members.inc
73
74 --let $MYSQLD_DATADIR= `select @@datadir;`
75 --exec $MYSQL_BINLOG $MYSQLD_DATADIR/server-binary-log.000001 > $MYSQLTEST_VARDIR/tmp/change_master_server1.sql
76
77 --echo # Asserting that CHANGE MASTER is not replicated in the binary log of the server.
78 --let $grep_file=$MYSQLTEST_VARDIR/tmp/change_master_server1.sql
79 --let $grep_pattern= CHANGE REPLICATION SOURCE
80 --let $grep_output= print_count
81 --source include/grep_pattern.inc
82
83 #Cleanup
84 --let $rpl_connection_name= server2
85 --source include/rpl_connection.inc
86 RESET SLAVE ALL FOR CHANNEL 'group_replication_recovery';
87
88 SET sql_log_bin=0;
89 DROP USER manish;
90 SET sql_log_bin=1;
91
92 --let $rpl_connection_name= server1
93 --source include/rpl_connection.inc
94
95 --remove_file $MYSQLTEST_VARDIR/tmp/change_master_server1.sql
96 --remove_file $MYSQLTEST_VARDIR/tmp/change_master_server2.sql
97 DROP TABLE t1;
98 SET sql_log_bin=0;
99 DROP USER manish;
100 SET sql_log_bin=1;
101 --source include/group_replication_end.inc