Debian Codegraph @

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

raw
1 ################################################################################
2 # Support to SKIP group gtid
3 #
4 # Case III - Support to skip gtid generated on multiple servers.
5 #
6 # Test:
7 # 0) The test requires two servers: M1 and M2.
8 # 1) With both members ONLINE in a group. GTID_EXECUTED must contain two
9 # transactions from view change events. Next sequence number is 3 on both the
10 # servers.
11 # 2) On M1 executes a transaction with GTID_NEXT=UUID_GROUP:3
12 # 3) On M2 execute a transaction, it will have:
13 # M1: UUID_GROUP:4
14 # M2: UUID_GROUP:4
15 # i.e. After this fix both servers should generate the same gtid (UUID_GROUP:4)
16 # 4) Check gtid_executed on M2. It must be UUID_GROUP:1-4.
17 # 5) Verify sequence of events in binlog of both M1 and M2.
18 # 6) Check gtid_executed on M1. It must be UUID_GROUP:1-4.
19 # 7) Clean up.
20 ################################################################################
21
22 --let $group_replication_group_name= 32e15fec-01d2-11e6-a992-02420ef39c5b
23 --source include/have_group_replication_plugin.inc
24 --source include/group_replication.inc
25
26 # The sequence of events that make up a View Change
27 --let $vcle_seq= Gtid # Query/BEGIN # View_change # Query/COMMIT
28
29 --let $rpl_connection_name= server1
30 --source include/rpl_connection.inc
31 SET SESSION sql_log_bin= 0;
32 --source include/gtid_utils.inc
33 SET SESSION sql_log_bin= 1;
34
35 --let $rpl_connection_name= server2
36 --source include/rpl_connection.inc
37 SET SESSION sql_log_bin= 0;
38 --source include/gtid_utils.inc
39 SET SESSION sql_log_bin= 1;
40
41 --let $rpl_connection_name= server1
42 --source include/rpl_connection.inc
43 --let $assert_text= GTID_EXECUTED must contain two transactions, two from view change events.
44 --let $assert_cond= GTID_IS_EQUAL(@@GLOBAL.GTID_EXECUTED,"$group_replication_group_name:1-2")
45 --source include/assert.inc
46
47 --echo # At this moment both the servers have next sequence number set to 2.
48 # Insert a transaction to with GTID set to UUID_GROUP:3.
49 --eval SET GTID_NEXT= "$group_replication_group_name:3"
50 CREATE TABLE t1 (i INT PRIMARY KEY);
51 SET GTID_NEXT='AUTOMATIC';
52
53 --source include/rpl_sync.inc
54
55 --let $assert_text= GTID_EXECUTED must contain three transactions, two from view change and other being the create.
56 --let $assert_cond= GTID_IS_EQUAL(@@GLOBAL.GTID_EXECUTED,"$group_replication_group_name:1-3")
57 --source include/assert.inc
58
59 --let $rpl_connection_name= server2
60 --source include/rpl_connection.inc
61
62 # Insert a transaction here to generate the next gtid automatically. This
63 # should skip the last gtid generated and use the next available value. i.e.
64 # UUID_GROUP:4.
65 INSERT INTO t1 VALUES(1);
66 --source include/rpl_sync.inc
67
68 # Checking the GTID_EXECUTED on the server2. This should be UUID_GROUP:1-4
69 --let $assert_text= GTID_EXECUTED must contain four transactions, two from view change, 1 create and 1 insert.
70 --let $assert_cond= GTID_IS_EQUAL(@@GLOBAL.GTID_EXECUTED,"$group_replication_group_name:1-4")
71 --source include/assert.inc
72
73 # View change (s1) # View change (s2) # Create table # Insert table
74 --let $event_sequence= $vcle_seq # $vcle_seq # Gtid # !Q(CREATE.*) # Gtid # !Begin # Table_map # Write_rows # !Commit
75 --source include/assert_binlog_events.inc
76
77 --let $rpl_connection_name= server1
78 --source include/rpl_connection.inc
79
80 # View change (s1) # View change (s2) # Create table # Insert table
81 --let $event_sequence= $vcle_seq # $vcle_seq # Gtid # !Q(CREATE.*) # Gtid # !Begin # Table_map # Write_rows # !Commit
82 --source include/assert_binlog_events.inc
83
84 --let $rpl_connection_name= server1
85 --source include/rpl_connection.inc
86 # Checking the GTID_EXECUTED on the server1. This should be UUID_GROUP:1-4
87 --let $assert_text= GTID_EXECUTED must contain four transactions, two from view change, 1 create and 1 insert.
88 --let $assert_cond= GTID_IS_EQUAL(@@GLOBAL.GTID_EXECUTED,"$group_replication_group_name:1-4")
89 --source include/assert.inc
90
91 # Cleanup
92
93 --let $rpl_connection_name= server1
94 --source include/rpl_connection.inc
95 SET SESSION sql_log_bin= 0;
96 --source include/gtid_utils_end.inc
97 SET SESSION sql_log_bin= 1;
98
99 --let $rpl_connection_name= server2
100 --source include/rpl_connection.inc
101 SET SESSION sql_log_bin= 0;
102 --source include/gtid_utils_end.inc
103 SET SESSION sql_log_bin= 1;
104
105 DROP TABLE t1;
106 --source include/group_replication_end.inc