Debian Codegraph @

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

raw
1 ################################################################################
2 # This test verifies that the slave server with binlog enabled is able to
3 # replicate from a member which is part of a Group.
4 #
5 # Test:
6 # 0. The test requires three servers: M1, M2 and M3.
7 # 1. Bootstrap start a group on M1. Start GR on M2 and add some data.
8 # 2. Connect the third server to one of the member of the group, establishing
9 # an asynchronous replication connection (M1->M3). Start slave on M3.
10 # 3. On the slave (M3), test that the data is properly replicated after the
11 # start slave is completed. Diff check the table on M1 and M3, and, verify
12 # binlog events on M3.
13 # 4. Cleanup.
14 ################################################################################
15 --source include/big_test.inc
16 --source include/have_group_replication_plugin.inc
17 --let $rpl_skip_group_replication_start= 1
18 --let $rpl_server_count= 3
19 --source include/group_replication.inc
20
21 # Start the first member here
22 --let $rpl_connection_name= server1
23 --source include/rpl_connection.inc
24 --source include/start_and_bootstrap_group_replication.inc
25
26 # Start the second member. Add some data and sync it in the group.
27 --let $rpl_connection_name= server2
28 --source include/rpl_connection.inc
29 --source include/start_group_replication.inc
30 CREATE TABLE test.t1 (i INT PRIMARY KEY);
31 INSERT INTO test.t1 VALUES(1);
32 --source include/rpl_sync.inc
33
34 # Establish an async connection between the third server and member 1 of
35 # the group.
36 --let $rpl_connection_name= server3
37 --source include/rpl_connection.inc
38
39 SET SESSION sql_log_bin= 0;
40 --source include/gtid_utils.inc
41 SET SESSION sql_log_bin= 1;
42
43 # Make this server the slave of the first server which belongs to the group.
44 --disable_warnings
45 --replace_result $MASTER_MYPORT MASTER_PORT
46 --eval CHANGE REPLICATION SOURCE TO SOURCE_HOST='127.0.0.1', SOURCE_PORT=$MASTER_MYPORT, SOURCE_USER='root', SOURCE_AUTO_POSITION=1
47 --enable_warnings
48 --source include/start_slave.inc
49
50 # Restart GR on M2 and add some data to the group. Verify that the same events are replicated to M3 later.
51 --let $rpl_connection_name= server2
52 --source include/rpl_connection.inc
53 --source include/stop_group_replication.inc
54 --source include/start_group_replication.inc
55 INSERT INTO test.t1 VALUES(2);
56 --source include/rpl_sync.inc
57
58 --let $rpl_connection_name= server1
59 --source include/rpl_connection.inc
60 --let $sync_slave_connection= server3
61 --source include/sync_slave_sql_with_master.inc
62
63 --echo # On the slave (server3), test that the data is properly replicated
64 --echo # after the start slave is complete.
65 --let $diff_tables= server1:test.t1, server3:test.t1
66 --source include/diff_tables.inc
67
68 # The sequence of events that make up a View Change
69 --let $vcle_seq= Gtid # Query/BEGIN # View_change # Query/COMMIT
70 # View change (s1) # View change (s2) # Create table # Insert # View change (s2) # Insert
71 --let $event_sequence= $vcle_seq # $vcle_seq # !Gtid_transaction # !Gtid_transaction # $vcle_seq # !Gtid_transaction
72 --source include/assert_binlog_events.inc
73
74 # Cleanup
75 --let $rpl_connection_name= server1
76 --source include/rpl_connection.inc
77 DROP TABLE test.t1;
78
79 --let $sync_slave_connection= server3
80 --source include/sync_slave_sql_with_master.inc
81 --source include/stop_slave.inc
82 CHANGE REPLICATION SOURCE TO SOURCE_AUTO_POSITION=0;
83 SET SESSION sql_log_bin= 0;
84 --source include/gtid_utils_end.inc
85 SET SESSION sql_log_bin= 1;
86 --source include/rpl_reset_slave.inc
87
88 --source include/group_replication_end.inc