MINI MINI MANI MO
################################################################################
# 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 ../inc/have_group_replication_plugin.inc
--let $rpl_skip_group_replication_start= 1
--source ../inc/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 ../inc/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 ../inc/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 ../inc/group_replication_end.inc
OHA YOOOO