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