Debian Codegraph @

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

raw
1 ################################################################################
2 # Support to SKIP group gtid
3 #
4 # CASE IV - Test for the gtid event generated during view change event.
5 #
6 # The GTID generated during VIEW_CHANGE should also skip the already executed
7 # group_gtid to avoid error.
8 #
9 # Test:
10 # 0) The test requires two servers: M1 and M2.
11 # 1) Bootstrap start a group on M1.
12 # 2) On M1 execute a transaction with GTID_NEXT=UUID_GROUP:2. M1 will have:
13 # GTID EXECUTED = UUID_GROUP:1-2.
14 # 3) Start GR on M2.
15 # 4) Check gtid_executed=UUID_GROUP:1-3 on M1.
16 # 5) Verify sequence of events in binlog on both M1 and M2.
17 # 6) Check gtid_executed=UUID_GROUP:1-3 on M2.
18 # 7) Clean up.
19 ################################################################################
20
21 --let $group_replication_group_name= 32e13b0c-01d2-11e6-a992-02420ef39c5b
22 --source include/have_group_replication_plugin.inc
23 --let $rpl_skip_group_replication_start= 1
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 --source include/start_and_bootstrap_group_replication.inc
44 --eval SET GTID_NEXT= "$group_replication_group_name:2"
45 CREATE TABLE t1 (i INT PRIMARY KEY);
46 SET GTID_NEXT='AUTOMATIC';
47
48 # Asserting the value of the already executed gtid on the server1.
49 --let $assert_text= GTID_EXECUTED must contain two transactions, one from view change and other being the create table.
50 --let $assert_cond= GTID_IS_EQUAL(@@GLOBAL.GTID_EXECUTED,"$group_replication_group_name:1-2")
51 --source include/assert.inc
52
53 --let $rpl_connection_name= server2
54 --source include/rpl_connection.inc
55
56 # Here start will trigger the new view change event to be generated with the
57 # next sequence number of the server1. This should also skip the already
58 # executed gtid.
59 --source include/start_group_replication.inc
60
61 --let $rpl_connection_name= server1
62 --source include/rpl_connection.inc
63 # Checking that the new GTID added to the gtid executed set is UUID_GROUP:3
64 # i.e. For the view change event triggered by the server2 joining the group.
65 --let $assert_text= GTID_EXECUTED must contain three transactions, the new one from the insert.
66 --let $assert_cond= GTID_IS_EQUAL(@@GLOBAL.GTID_EXECUTED,"$group_replication_group_name:1-3")
67 --source include/assert.inc
68
69 # View change (s1) # Create table # View change (s2)
70 --let $event_sequence= $vcle_seq # !Gtid_transaction # $vcle_seq
71 --source include/assert_binlog_events.inc
72
73 --let $rpl_connection_name= server2
74 --source include/rpl_connection.inc
75 # View change (s1) # Create table # View change (s2)
76 --let $event_sequence= $vcle_seq # !Gtid_transaction # $vcle_seq
77 --source include/assert_binlog_events.inc
78
79 --let $assert_text= GTID_EXECUTED must contain three transactions, the new one from the insert.
80 --let $assert_cond= GTID_IS_EQUAL(@@GLOBAL.GTID_EXECUTED,"$group_replication_group_name:1-3")
81 --source include/assert.inc
82
83 # Cleanup
84
85 DROP TABLE t1;
86 --source include/rpl_sync.inc
87
88 --let $rpl_connection_name= server1
89 --source include/rpl_connection.inc
90 SET SESSION sql_log_bin= 0;
91 --source include/gtid_utils_end.inc
92 SET SESSION sql_log_bin= 1;
93 --let $rpl_connection_name= server2
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 --source include/group_replication_end.inc