Debian Codegraph @

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

raw
1 ################################################################################
2 # BUG#21180035 - ADD SUPPORT TO SKIP GTIDS ON GROUP REPLICATION
3 #
4 # CASE II - A member joins after the specified GTID next in the group.
5 #
6 # Test:
7 # 0) The test requires two servers: M1 and M2.
8 # 1) Bootstrap start a group on M1. First view change is UUID_GROUP:1.
9 # 2) On M1, executes a transaction with GTID_NEXT=UUID_GROUP:3.
10 # Check gtid_executed=UUID_GROUP:1:3.
11 # 3) Start GR on M2. Check gtid_executed=UUID_GROUP:1-3.
12 # 4) Check gtid_executed=UUID_GROUP:1-3 on M1 too.
13 # 5) On M1 execute a transaction, it will have:
14 # M1: UUID_GROUP:4
15 # M2: UUID_GROUP:4 should be generated.
16 # 6) Check gtid_executed on M1. It must be UUID_GROUP:1-4.
17 # 7) Verify sequence of events in binlog of both M1 and M2.
18 # 8) Check gtid_executed on M2. It must be UUID_GROUP:1-4.
19 # 9) Cleanup.
20 ################################################################################
21
22 --let $group_replication_group_name= 32e153f8-01d2-11e6-a992-02420ef39c5b
23 --source include/have_group_replication_plugin.inc
24 --let $rpl_skip_group_replication_start= 1
25 --source include/group_replication.inc
26
27 # The sequence of events that make up a View Change
28 --let $vcle_seq= Gtid # Query/BEGIN # View_change # Query/COMMIT
29
30 --let $rpl_connection_name= server1
31 --source include/rpl_connection.inc
32 SET SESSION sql_log_bin= 0;
33 --source include/gtid_utils.inc
34 SET SESSION sql_log_bin= 1;
35
36 --let $rpl_connection_name= server2
37 --source include/rpl_connection.inc
38 SET SESSION sql_log_bin= 0;
39 --source include/gtid_utils.inc
40 SET SESSION sql_log_bin= 1;
41
42 --let $rpl_connection_name= server1
43 --source include/rpl_connection.inc
44 --source include/start_and_bootstrap_group_replication.inc
45
46 --eval SET GTID_NEXT= "$group_replication_group_name:3"
47 # Applying a transaction with UUID_GROUP:3 set which will be skipped later in
48 # the test.
49 CREATE TABLE t1 (i INT PRIMARY KEY);
50 --source include/rpl_sync.inc
51 SET GTID_NEXT='AUTOMATIC';
52
53 --let $assert_text= GTID_EXECUTED must contain two transactions, one from view change and other being the create table.
54 --let $assert_cond= GTID_IS_EQUAL(@@GLOBAL.GTID_EXECUTED,"$group_replication_group_name:1:3")
55 --source include/assert.inc
56
57 # Starting group_replication on server2. This will trigger the next sequence
58 # number to be generated on server1 thereby increasing the sequence number to
59 # 3 on both the servers.
60 --let $rpl_connection_name= server2
61 --source include/rpl_connection.inc
62 --source include/start_group_replication.inc
63
64 # Checking the GTID_EXECUTED on the server2. This should be UUID_GROUP:1-3
65 # here as well.
66 --let $assert_text= GTID_EXECUTED must contain three transactions, two from view change and other being the create.
67 --let $assert_cond= GTID_IS_EQUAL(@@GLOBAL.GTID_EXECUTED,"$group_replication_group_name:1-3")
68 --source include/assert.inc
69
70 --let $rpl_connection_name= server1
71 --source include/rpl_connection.inc
72
73 # Checking the GTID_EXECUTED on the server1. This should be UUID_GROUP:1-3
74 # here as well.
75 --let $assert_text= GTID_EXECUTED must contain three transactions, two from view change and other being the create.
76 --let $assert_cond= GTID_IS_EQUAL(@@GLOBAL.GTID_EXECUTED,"$group_replication_group_name:1-3")
77 --source include/assert.inc
78
79 # Insert a row in the table t1. This will create a new GTID which will skip as
80 # the next seqno is conflicting with the one already logged. So UUID_GROUP:4
81 # will be generated.
82
83 --let $rpl_connection_name= server1
84 --source include/rpl_connection.inc
85 INSERT INTO t1 VALUES(1);
86 --source include/rpl_sync.inc
87
88 --let $assert_text= GTID_EXECUTED must contain four transactions, the new one from the insert.
89 --let $assert_cond= GTID_IS_EQUAL(@@GLOBAL.GTID_EXECUTED,"$group_replication_group_name:1-4")
90 --source include/assert.inc
91
92 # View change (s1) # Create table # View change (s2) # Insert table
93 --let $event_sequence= $vcle_seq # Gtid # !Q(CREATE.*) # $vcle_seq # Gtid # !Begin # Table_map # Write_rows # !Commit
94 --source include/assert_binlog_events.inc
95
96 --let $rpl_connection_name= server2
97 --source include/rpl_connection.inc
98 # View change (s1) # Create table # View change (s2) # Insert table
99 --let $event_sequence= $vcle_seq # Gtid # !Q(CREATE.*) # $vcle_seq # Gtid # !Begin # Table_map # Write_rows # !Commit
100 --source include/assert_binlog_events.inc
101
102 --let $assert_text= GTID_EXECUTED must contain four transactions, the new one from the insert.
103 --let $assert_cond= GTID_IS_EQUAL(@@GLOBAL.GTID_EXECUTED,"$group_replication_group_name:1-4")
104 --source include/assert.inc
105
106 # Cleanup
107
108 DROP TABLE t1;
109 --let $rpl_connection_name= server1
110 --source include/rpl_connection.inc
111 SET SESSION sql_log_bin= 0;
112 --source include/gtid_utils_end.inc
113 SET SESSION sql_log_bin= 1;
114 --let $rpl_connection_name= server2
115 --source include/rpl_connection.inc
116 SET SESSION sql_log_bin= 0;
117 --source include/gtid_utils_end.inc
118 SET SESSION sql_log_bin= 1;
119 --source include/group_replication_end.inc