| 1 |
################################################################################ |
| 2 |
# Support to SKIP group gtid |
| 3 |
# |
| 4 |
# CASE V - Test for the gtid event generated during view change event and |
| 5 |
# whether it is skipped in case the entire group goes down. |
| 6 |
# |
| 7 |
# The GTID generated during VIEW_CHANGE should also skip the already executed |
| 8 |
# group_gtid to avoid error. |
| 9 |
# |
| 10 |
# Test: |
| 11 |
# 0) The test requires two servers: M1 and M2. |
| 12 |
# 1) Bootstrap start a group on M1. Create a table. M1 will have: |
| 13 |
# GTID EXECUTED = UUID_GROUP:1-2. |
| 14 |
# 2) Start GR on M2. M1 will have GTID EXECUTED = UUID_GROUP:1-3. |
| 15 |
# 3) Verify sequence of events in binlog on both M1 and M2. |
| 16 |
# 4) Stop GR on M2 |
| 17 |
# 5) Insert an row in the table on M1 with gno as 5 i.e. UUID_GROUP:4 |
| 18 |
# Insert an row in the table on M1 with gno as 7 i.e. UUID_GROUP:5. |
| 19 |
# 6) Stop GR on M1. |
| 20 |
# 7) Bootstrap start a group on M1 (UUID_GROUP:6). Start GR on M2 (UUID_GROUP:7) |
| 21 |
# 8) Verify sequence of events in binlog on both M1 and M2. |
| 22 |
# 9) M1 must have GTID EXECUTED = UUID_GROUP:1-7. |
| 23 |
# 10) Clean up. |
| 24 |
################################################################################ |
| 25 |
|
| 26 |
--source include/big_test.inc |
| 27 |
--let $group_replication_group_name= 32e12bc9-01d2-11e6-a992-02420ef39c5b |
| 28 |
--source include/have_group_replication_plugin.inc |
| 29 |
--let $rpl_skip_group_replication_start= 1 |
| 30 |
--source include/group_replication.inc |
| 31 |
|
| 32 |
# The sequence of events that make up a View Change |
| 33 |
--let $vcle_seq= Gtid # Query/BEGIN # View_change # Query/COMMIT |
| 34 |
|
| 35 |
--let $rpl_connection_name= server1 |
| 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= server2 |
| 42 |
--source include/rpl_connection.inc |
| 43 |
SET SESSION sql_log_bin= 0; |
| 44 |
--source include/gtid_utils.inc |
| 45 |
SET SESSION sql_log_bin= 1; |
| 46 |
|
| 47 |
--let $rpl_connection_name= server1 |
| 48 |
--source include/rpl_connection.inc |
| 49 |
--source include/start_and_bootstrap_group_replication.inc |
| 50 |
CREATE TABLE t1 (i INT PRIMARY KEY); |
| 51 |
|
| 52 |
# Asserting the value of the already executed gtid on the server1. |
| 53 |
--let $assert_text= GTID_EXECUTED must contain two transactions, one from view change and other being the create table. |
| 54 |
--let $assert_cond= GTID_IS_EQUAL(@@GLOBAL.GTID_EXECUTED,"$group_replication_group_name:1-2") |
| 55 |
--source include/assert.inc |
| 56 |
|
| 57 |
--let $rpl_connection_name= server2 |
| 58 |
--source include/rpl_connection.inc |
| 59 |
|
| 60 |
# Here start will trigger the new view change event to be generated with the |
| 61 |
# next sequence number of the server1. This should also skip the already |
| 62 |
# execuetd gtid. |
| 63 |
--source include/start_group_replication.inc |
| 64 |
|
| 65 |
--let $rpl_connection_name= server1 |
| 66 |
--source include/rpl_connection.inc |
| 67 |
# Checking that the new GTID added to the gtid executed set is UUID_GROUP:3 |
| 68 |
# i.e. For the view change event triggered by the server2 joining the group. |
| 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 |
# View change (s1) # Create table # View change (s2) |
| 74 |
--let $event_sequence= $vcle_seq # !Gtid_transaction # $vcle_seq |
| 75 |
--source include/assert_binlog_events.inc |
| 76 |
|
| 77 |
--let $rpl_connection_name= server2 |
| 78 |
--source include/rpl_connection.inc |
| 79 |
# View change (s1) # Create table # View change (s2) |
| 80 |
--let $event_sequence= $vcle_seq # !Gtid_transaction # $vcle_seq |
| 81 |
--source include/assert_binlog_events.inc |
| 82 |
|
| 83 |
--source include/stop_group_replication.inc |
| 84 |
|
| 85 |
--let $rpl_connection_name= server1 |
| 86 |
--source include/rpl_connection.inc |
| 87 |
|
| 88 |
# Insert a row with GTID specified to the next possible generated value. |
| 89 |
--eval SET GTID_NEXT= "$group_replication_group_name:4" |
| 90 |
INSERT INTO t1 VALUES(2); |
| 91 |
|
| 92 |
# Insert a row with GTID specified to the value of the second node view change |
| 93 |
# event value. |
| 94 |
--eval SET GTID_NEXT= "$group_replication_group_name:5" |
| 95 |
INSERT INTO t1 VALUES(3); |
| 96 |
|
| 97 |
SET GTID_NEXT='AUTOMATIC'; |
| 98 |
|
| 99 |
--source include/stop_group_replication.inc |
| 100 |
|
| 101 |
# This start group replication will generate a view change event with GTID |
| 102 |
# $group_replication_group_name:6. |
| 103 |
--let $rpl_connection_name= server1 |
| 104 |
--source include/rpl_connection.inc |
| 105 |
--source include/start_and_bootstrap_group_replication.inc |
| 106 |
|
| 107 |
# This start group replication will generate a view change event with GTID |
| 108 |
# $group_replication_group_name:7 |
| 109 |
--let $rpl_connection_name= server2 |
| 110 |
--source include/rpl_connection.inc |
| 111 |
--source include/start_group_replication.inc |
| 112 |
|
| 113 |
# View change (s1) # Create table # View change (s2) # Insert # Insert # View change (s1) # View change (s2) |
| 114 |
--let $event_sequence= $vcle_seq # !Gtid_transaction # $vcle_seq # !Gtid_transaction # !Gtid_transaction # $vcle_seq # $vcle_seq |
| 115 |
--source include/assert_binlog_events.inc |
| 116 |
|
| 117 |
--let $rpl_connection_name= server1 |
| 118 |
--source include/rpl_connection.inc |
| 119 |
# View change (s1) # Create table # View change (s2) # Insert # Insert # View change (s1) # View change (s2) |
| 120 |
--let $event_sequence= $vcle_seq # !Gtid_transaction # $vcle_seq # !Gtid_transaction # !Gtid_transaction # $vcle_seq # $vcle_seq |
| 121 |
--source include/assert_binlog_events.inc |
| 122 |
|
| 123 |
--let $assert_text= The GTID EXECUTED must not contain holes. |
| 124 |
--let $assert_cond= GTID_IS_EQUAL("[SELECT @@GLOBAL.GTID_EXECUTED]", "$group_replication_group_name:1-7") |
| 125 |
--source include/assert.inc |
| 126 |
|
| 127 |
# Cleanup |
| 128 |
|
| 129 |
DROP TABLE t1; |
| 130 |
--source include/rpl_sync.inc |
| 131 |
|
| 132 |
--let $rpl_connection_name= server1 |
| 133 |
--source include/rpl_connection.inc |
| 134 |
SET SESSION sql_log_bin= 0; |
| 135 |
--source include/gtid_utils_end.inc |
| 136 |
SET SESSION sql_log_bin= 1; |
| 137 |
--let $rpl_connection_name= server2 |
| 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 |
|
| 143 |
--source include/group_replication_end.inc |