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 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188
|
################################################################################
# Test that evaluates the safe guards that stop members from joining with
# transactions not present in the group.
#
# Here we test several cases where the joiner is allowed or not in the group
# based on its executed transaction set.
#
# Test guide:
# 0. The test requires three servers.
# Test case 1: A member that has an unrelated transaction fails to join
# 1) There is a group with a member that has some transactions
# 2) Insert a transaction on server 2 that acquires a local GTID
# 3) Server 2 fails to join because the group doesn't know that GTID
#
# Test case 2: A member that has more group transactions fails to join
# 1) Take server 1 out of the group.
# 2) Clean server 2 and boot the group again with it
# 3) Try to add server 1 to the group. It fails because server 1 has 5
# transaction and server 2 only has 1
#
# 3. Verify all is fine.
#
# 4. Clean up.
################################################################################
--source include/big_test.inc
--let $group_replication_group_name= b2b6cdc0-eb94-11e5-a837-0800200c9a66
--source include/have_group_replication_plugin.inc
--let $rpl_gtid_utils= 1
--let $rpl_skip_group_replication_start= 1
--source include/group_replication.inc
--let $errand_transaction_uuid= aaaaaaaa-bbbb-aaaa-bbbb-aaaaaaaaaaaa
# Suppress errors
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
SET SESSION sql_log_bin= 0;
call mtr.add_suppression(".*This member has more executed transactions *.*");
call mtr.add_suppression(".*The member contains transactions not present *.*");
SET SESSION sql_log_bin= 1;
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
SET SESSION sql_log_bin= 0;
call mtr.add_suppression(".*This member has more executed transactions *.*");
call mtr.add_suppression(".*The member contains transactions not present *.*");
SET SESSION sql_log_bin= 1;
--echo #
--echo # Setup the first member
--echo #
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--source include/start_and_bootstrap_group_replication.inc
# Add some data for recovery
CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
--let $assert_text= The first member has 3 transaction belonging to the group
--let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$group_replication_group_name:1-3";
--source include/assert.inc
--echo #
--echo # Test case 1: Try to add a member with local data on it.
--echo # The start group replication command shall fail
--echo #
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--eval SET GTID_NEXT= "$errand_transaction_uuid:1"
CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
SET GTID_NEXT= "AUTOMATIC";
--let $assert_text= The member shall contain a local transaction
--let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$errand_transaction_uuid:1";
--source include/assert.inc
--eval SET GLOBAL group_replication_group_name= "$group_replication_group_name"
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
--echo # Test case 1 cleanup
--echo # Remove data on server 2
DROP TABLE t2;
RESET MASTER;
#For precaution, wait for server 2 to leave
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--let $group_replication_number_of_members= 1
--source include/gr_wait_for_number_of_members.inc
# Wait until View_change_log_event from server 2 join is logged on binary log
--let $wait_condition= SELECT @@GLOBAL.GTID_EXECUTED = "$group_replication_group_name:1-4"
--source include/wait_condition.inc
--echo #
--echo # Test case 2: Try to add a member with more group transactions
--echo # The start group replication command shall fail
--echo #
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--source include/stop_group_replication.inc
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--source include/start_and_bootstrap_group_replication.inc
--let $assert_text= The first member to join has only one transaction
--let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$group_replication_group_name:1";
--source include/assert.inc
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--let $assert_text= The second member to join has 4 transactions
--let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$group_replication_group_name:1-4";
--source include/assert.inc
--eval SET GLOBAL group_replication_group_name= "$group_replication_group_name"
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;
--echo # Test case 2 cleanup
--echo # Put server 1 back in the group
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
#For precaution, wait for server 1 to leave
--let $group_replication_number_of_members= 1
--source include/gr_wait_for_number_of_members.inc
--source include/stop_group_replication.inc
RESET MASTER;
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--source include/start_and_bootstrap_group_replication.inc
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--source include/start_group_replication.inc
--echo #
--echo # Verify all is fine
--echo #
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
INSERT INTO t1 VALUES (2);
--source include/rpl_sync.inc
--let $assert_text= 'There are two values in table t1'
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1, count, 1] = 2
--source include/assert.inc
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--let $assert_text= 'There are two values in table t1'
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1, count, 1] = 2
--source include/assert.inc
--echo #
--echo # Cleaning up
--echo #
DROP TABLE t1;
--source include/group_replication_end.inc
|