| 1 |
################################################################################ |
| 2 |
# Validate that when a member is stopped with holes on group |
| 3 |
# gtids, those holes will be filled by the next transactions. |
| 4 |
# |
| 5 |
# Test: |
| 6 |
# 0. The test requires two servers: M1 and M2. |
| 7 |
# 1. Bootstrap start a group on M1 and create a table on it. |
| 8 |
# 2. Start GR on M2. Assert check that both members have 3 GTIDs. Stop GR on M2. |
| 9 |
# 3. Execute transactions with specificed GTIDs to create holes on GTID_EXECUTED |
| 10 |
# on M1. |
| 11 |
# 4. Shutdown the group i.e. stop GR on M1 too. |
| 12 |
# - GTID_EXECUTED must contain holes. |
| 13 |
# - Bootstrap start a group on M1. |
| 14 |
# - GTID_EXECUTED must contain no holes. |
| 15 |
# - Assert check the events sequence in binlog of M1. |
| 16 |
# 5. Start GR on M2. |
| 17 |
# - GTID_EXECUTED must contain no holes. |
| 18 |
# - Assert check the events sequence in binlog of M2. |
| 19 |
# 6. Clean up. |
| 20 |
################################################################################ |
| 21 |
--source include/big_test.inc |
| 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 |
--let $rpl_connection_name= server2 |
| 35 |
--source include/rpl_connection.inc |
| 36 |
SET SESSION sql_log_bin= 0; |
| 37 |
--source include/gtid_utils.inc |
| 38 |
SET SESSION sql_log_bin= 1; |
| 39 |
|
| 40 |
|
| 41 |
--echo |
| 42 |
--echo ############################################################ |
| 43 |
--echo # 1. Bootstrap the group and create a table on it. |
| 44 |
--let $rpl_connection_name= server1 |
| 45 |
--source include/rpl_connection.inc |
| 46 |
--source include/start_and_bootstrap_group_replication.inc |
| 47 |
CREATE TABLE t1 (i INT PRIMARY KEY); |
| 48 |
|
| 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 |
|
| 54 |
--echo |
| 55 |
--echo ############################################################ |
| 56 |
--echo # 2. Add one more member to the group. |
| 57 |
--echo # Assert that both members have 3 GTIDs. |
| 58 |
--echo # Server 2 leaves the group. |
| 59 |
--let $rpl_connection_name= server2 |
| 60 |
--source include/rpl_connection.inc |
| 61 |
--source include/start_group_replication.inc |
| 62 |
|
| 63 |
--let $assert_text= GTID_EXECUTED must contain three transactions, the new one from the insert. |
| 64 |
--let $assert_cond= GTID_IS_EQUAL(@@GLOBAL.GTID_EXECUTED,"$group_replication_group_name:1-3") |
| 65 |
--source include/assert.inc |
| 66 |
|
| 67 |
--let $rpl_connection_name= server1 |
| 68 |
--source include/rpl_connection.inc |
| 69 |
--let $assert_text= GTID_EXECUTED must contain three transactions, the new one from the insert. |
| 70 |
--let $assert_cond= GTID_IS_EQUAL(@@GLOBAL.GTID_EXECUTED,"$group_replication_group_name:1-3") |
| 71 |
--source include/assert.inc |
| 72 |
|
| 73 |
--let $rpl_connection_name= server2 |
| 74 |
--source include/rpl_connection.inc |
| 75 |
# On server 1 a view with GTID group_replication_group_name:4 will be logged. |
| 76 |
--source include/stop_group_replication.inc |
| 77 |
|
| 78 |
|
| 79 |
--echo |
| 80 |
--echo ############################################################ |
| 81 |
--echo # 3. Execute transactions with specificed GTIDs to create |
| 82 |
--echo # holes on GTID_EXECUTED. |
| 83 |
--let $rpl_connection_name= server1 |
| 84 |
--source include/rpl_connection.inc |
| 85 |
# Insert a row with GTID specified to the next possible generated value. |
| 86 |
--replace_result $group_replication_group_name GROUP_REPLICATION_GROUP_NAME |
| 87 |
--eval SET GTID_NEXT= "$group_replication_group_name:4" |
| 88 |
INSERT INTO t1 VALUES(5); |
| 89 |
|
| 90 |
# Insert a row with GTID specified to create a hole. |
| 91 |
--replace_result $group_replication_group_name GROUP_REPLICATION_GROUP_NAME |
| 92 |
--eval SET GTID_NEXT= "$group_replication_group_name:6" |
| 93 |
INSERT INTO t1 VALUES(6); |
| 94 |
SET GTID_NEXT='AUTOMATIC'; |
| 95 |
|
| 96 |
|
| 97 |
--echo |
| 98 |
--echo ############################################################ |
| 99 |
--echo # 4. Shutdown the group and bootstrap the group again. |
| 100 |
--source include/stop_group_replication.inc |
| 101 |
--let $assert_text= GTID_EXECUTED must contain holes |
| 102 |
--let $assert_cond= GTID_IS_EQUAL(@@GLOBAL.GTID_EXECUTED,"$group_replication_group_name:1-4:6") |
| 103 |
--source include/assert.inc |
| 104 |
|
| 105 |
--source include/start_and_bootstrap_group_replication.inc |
| 106 |
--let $assert_text= GTID_EXECUTED must contain no holes |
| 107 |
--let $assert_cond= GTID_IS_EQUAL(@@GLOBAL.GTID_EXECUTED,"$group_replication_group_name:1-6") |
| 108 |
--source include/assert.inc |
| 109 |
|
| 110 |
# GTID group_replication_group_name:5 was used for the view on |
| 111 |
# which server1 did bootstrap the group again. |
| 112 |
# View change (s1) # Create table # View change (s2) # Insert # Insert # View change (s1) |
| 113 |
--let $event_sequence= $vcle_seq # !Gtid_transaction # $vcle_seq # !Gtid_transaction # !Gtid_transaction # $vcle_seq |
| 114 |
--source include/assert_binlog_events.inc |
| 115 |
|
| 116 |
|
| 117 |
--echo |
| 118 |
--echo ############################################################ |
| 119 |
--echo # 5. Server 2 joins the group again. |
| 120 |
--let $rpl_connection_name= server2 |
| 121 |
--source include/rpl_connection.inc |
| 122 |
--source include/start_group_replication.inc |
| 123 |
--let $assert_text= GTID_EXECUTED must contain no holes |
| 124 |
--let $assert_cond= GTID_IS_EQUAL(@@GLOBAL.GTID_EXECUTED,"$group_replication_group_name:1-7") |
| 125 |
--source include/assert.inc |
| 126 |
|
| 127 |
# View change (s1) # Create table # View change (s2) # Insert # Insert # View change (s1) # View change (s2) |
| 128 |
--let $event_sequence= $vcle_seq # !Gtid_transaction # $vcle_seq # !Gtid_transaction # !Gtid_transaction # $vcle_seq # $vcle_seq |
| 129 |
--source include/assert_binlog_events.inc |
| 130 |
|
| 131 |
|
| 132 |
--echo |
| 133 |
--echo ############################################################ |
| 134 |
--echo # 6. Cleanup. |
| 135 |
DROP TABLE t1; |
| 136 |
|
| 137 |
--let $rpl_connection_name= server1 |
| 138 |
--source include/rpl_connection.inc |
| 139 |
SET SESSION sql_log_bin= 0; |
| 140 |
--source include/gtid_utils_end.inc |
| 141 |
SET SESSION sql_log_bin= 1; |
| 142 |
--let $rpl_connection_name= server2 |
| 143 |
--source include/rpl_connection.inc |
| 144 |
SET SESSION sql_log_bin= 0; |
| 145 |
--source include/gtid_utils_end.inc |
| 146 |
SET SESSION sql_log_bin= 1; |
| 147 |
|
| 148 |
--source include/group_replication_end.inc |