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 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
|
################################################################################
# Validate that when a member is stopped with holes on group
# gtids, those holes will be filled by the next transactions.
#
# Test:
# 0. The test requires two servers: M1 and M2.
# 1. Bootstrap start a group on M1 and create a table on it.
# 2. Start GR on M2. Assert check that both members have 3 GTIDs. Stop GR on M2.
# 3. Execute transactions with specificed GTIDs to create holes on GTID_EXECUTED
# on M1.
# 4. Shutdown the group i.e. stop GR on M1 too.
# - GTID_EXECUTED must contain holes.
# - Bootstrap start a group on M1.
# - GTID_EXECUTED must contain no holes.
# - Assert check the events sequence in binlog of M1.
# 5. Start GR on M2.
# - GTID_EXECUTED must contain no holes.
# - Assert check the events sequence in binlog of M2.
# 6. Clean up.
################################################################################
--source include/big_test.inc
--source include/have_group_replication_plugin.inc
--let $rpl_skip_group_replication_start= 1
--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;
--echo
--echo ############################################################
--echo # 1. Bootstrap the group and create a table on it.
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--source include/start_and_bootstrap_group_replication.inc
CREATE TABLE t1 (i INT PRIMARY KEY);
--let $assert_text= GTID_EXECUTED must contain two transactions, one from view change and other being the create table.
--let $assert_cond= GTID_IS_EQUAL(@@GLOBAL.GTID_EXECUTED,"$group_replication_group_name:1-2")
--source include/assert.inc
--echo
--echo ############################################################
--echo # 2. Add one more member to the group.
--echo # Assert that both members have 3 GTIDs.
--echo # Server 2 leaves the group.
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--source include/start_group_replication.inc
--let $assert_text= GTID_EXECUTED must contain three transactions, the new one from the insert.
--let $assert_cond= GTID_IS_EQUAL(@@GLOBAL.GTID_EXECUTED,"$group_replication_group_name:1-3")
--source include/assert.inc
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--let $assert_text= GTID_EXECUTED must contain three transactions, the new one from the insert.
--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
# On server 1 a view with GTID group_replication_group_name:4 will be logged.
--source include/stop_group_replication.inc
--echo
--echo ############################################################
--echo # 3. Execute transactions with specificed GTIDs to create
--echo # holes on GTID_EXECUTED.
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
# Insert a row with GTID specified to the next possible generated value.
--replace_result $group_replication_group_name GROUP_REPLICATION_GROUP_NAME
--eval SET GTID_NEXT= "$group_replication_group_name:4"
INSERT INTO t1 VALUES(5);
# Insert a row with GTID specified to create a hole.
--replace_result $group_replication_group_name GROUP_REPLICATION_GROUP_NAME
--eval SET GTID_NEXT= "$group_replication_group_name:6"
INSERT INTO t1 VALUES(6);
SET GTID_NEXT='AUTOMATIC';
--echo
--echo ############################################################
--echo # 4. Shutdown the group and bootstrap the group again.
--source include/stop_group_replication.inc
--let $assert_text= GTID_EXECUTED must contain holes
--let $assert_cond= GTID_IS_EQUAL(@@GLOBAL.GTID_EXECUTED,"$group_replication_group_name:1-4:6")
--source include/assert.inc
--source include/start_and_bootstrap_group_replication.inc
--let $assert_text= GTID_EXECUTED must contain no holes
--let $assert_cond= GTID_IS_EQUAL(@@GLOBAL.GTID_EXECUTED,"$group_replication_group_name:1-6")
--source include/assert.inc
# GTID group_replication_group_name:5 was used for the view on
# which server1 did bootstrap the group again.
# View change (s1) # Create table # View change (s2) # Insert # Insert # View change (s1)
--let $event_sequence= $vcle_seq # !Gtid_transaction # $vcle_seq # !Gtid_transaction # !Gtid_transaction # $vcle_seq
--source include/assert_binlog_events.inc
--echo
--echo ############################################################
--echo # 5. Server 2 joins the group again.
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--source include/start_group_replication.inc
--let $assert_text= GTID_EXECUTED must contain no holes
--let $assert_cond= GTID_IS_EQUAL(@@GLOBAL.GTID_EXECUTED,"$group_replication_group_name:1-7")
--source include/assert.inc
# View change (s1) # Create table # View change (s2) # Insert # Insert # View change (s1) # View change (s2)
--let $event_sequence= $vcle_seq # !Gtid_transaction # $vcle_seq # !Gtid_transaction # !Gtid_transaction # $vcle_seq # $vcle_seq
--source include/assert_binlog_events.inc
--echo
--echo ############################################################
--echo # 6. Cleanup.
DROP TABLE t1;
--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;
--source include/group_replication_end.inc
|