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 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226
|
################################################################################
# Test that evaluates the safe guards that stop members from joining with
# transactions not present in the group.
#
# Here we test that a joiner can't sometimes enter the group when it has less
# executed transactions than the group in its total. This happens if the merge
# of the joiner executed and received sets is bigger than the group total set of
# GTIDs.
# In total the joiner has more transactions than the group, so it can't join.
#
# Test guide:
# 0) The test requires three servers: M1, M2 and M3.
# 1) With all the 3 members ONLINE, create a table on M1. Check 4 transactions
# belonging to the GROUP on M2 and M3. Block the applier on M2 so it can't
# apply remote transactions.
# 2) Execute more transaction on M1. Check 6 transactions belonging to the
# GROUP on M3 then make M3 leave.
# 3) Execute some more transactions and check M2 has applied none.
# 4) Remove M1 and M2.
# 5) Try bootstrap add M3 back to the group.
# 6) Check that M3 (the group) has less executed GTIDs than M2. M2 can't
# still join the group because M2 has more transactions when we take
# into account its received transactions.
# 7) Clean up.
################################################################################
--source include/big_test.inc
--source include/have_debug_sync.inc
--let $group_replication_group_name= ba8c9f00-ec68-11e5-a837-0800200c9a66
--source include/have_group_replication_plugin.inc
--let $rpl_server_count= 3
--source include/group_replication.inc
# Suppress errors
--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 *.*");
call mtr.add_suppression("Replica SQL for channel 'group_replication_applier': Relay log read failure: Could not parse relay log event entry.*");
call mtr.add_suppression("The applier thread execution was aborted. Unable to process more transactions, this member will now leave the group.");
call mtr.add_suppression("Fatal error during execution on the Applier process of Group Replication. The server will now leave the group.");
call mtr.add_suppression("The server was automatically set into read only mode after an error was detected.");
call mtr.add_suppression("Skipping leave operation: concurrent attempt to leave the group is on-going.");
SET SESSION sql_log_bin= 1;
--echo #
--echo # Create a table for testing on server 1
--echo #
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
--source include/rpl_sync.inc
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--let $assert_text= Server 2 has 4 transaction belonging to the group
--let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$group_replication_group_name:1-4";
--source include/assert.inc
--let $rpl_connection_name= server3
--source include/rpl_connection.inc
--let $assert_text= Server 3 has 4 transaction belonging to the group
--let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$group_replication_group_name:1-4";
--source include/assert.inc
--echo #
--echo # Step 1: Block the applier on server 2.
--echo #
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
SET @@GLOBAL.DEBUG='+d,block_applier_updates';
--echo #
--echo # Step 2: Insert some transaction and remove server 3
--echo #
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (2);
--let $sync_slave_connection= server3
--source include/sync_slave_sql_with_master.inc
--let $assert_text= Server 3 has 6 transaction belonging to the group
--let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$group_replication_group_name:1-6";
--source include/assert.inc
--source include/stop_group_replication.inc
--echo #
--echo # Step 3: Insert more transactions. Assert that server 2 applied none
--echo #
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
INSERT INTO t1 VALUES (3);
INSERT INTO t1 VALUES (4);
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--let $wait_condition= SELECT received_transaction_set="$group_replication_group_name:1-8" FROM performance_schema.replication_connection_status WHERE channel_name='group_replication_applier';
--source include/wait_condition.inc
--echo #
--echo # Step 4: Stop group replication on server 1 and server 2
--echo #
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
# Stop before committing the received transactions.
SET DEBUG_SYNC = "now WAIT_FOR applier_read_blocked";
SET @@GLOBAL.DEBUG='-d,block_applier_updates';
SET @@GLOBAL.DEBUG='+d,force_sql_thread_error';
SET DEBUG_SYNC = "now SIGNAL resume_applier_read";
--let $group_replication_member_state= ERROR
--source include/gr_wait_for_member_state.inc
SET @@GLOBAL.DEBUG='-d,force_sql_thread_error';
SET DEBUG_SYNC= 'RESET';
--source include/stop_group_replication.inc
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--source include/stop_group_replication.inc
--echo #
--echo # Step 5: Boot the group again with server 3
--echo #
--let $rpl_connection_name= server3
--source include/rpl_connection.inc
--source include/start_and_bootstrap_group_replication.inc
--echo #
--echo # Step 6: Try to join server 2 that was less executed GTIDs
--echo # The start should fail as server 2 has more transactions in total
--echo #
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--let $assert_text= Server 2 has 4 transaction belonging to the group
--let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$group_replication_group_name:1-4";
--source include/assert.inc
--let $rpl_connection_name= server3
--source include/rpl_connection.inc
--let $assert_text= Server 3 has 7 transaction belonging to the group
--let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$group_replication_group_name:1-7";
--source include/assert.inc
--let $rpl_connection_name= server_2
--source include/rpl_connection.inc
LOCK TABLE t1 READ;
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--eval SET GLOBAL group_replication_group_name= "$group_replication_group_name"
--send
START GROUP_REPLICATION;
--let $rpl_connection_name= server_2
--source include/rpl_connection.inc
UNLOCK TABLES;
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--error ER_GROUP_REPLICATION_CONFIGURATION
--reap
#for safety wait for it to leave
--let $rpl_connection_name= server3
--source include/rpl_connection.inc
--let $group_replication_number_of_members= 1
--source include/gr_wait_for_number_of_members.inc
--echo #
--echo # Step 7: Clean up
--echo #
--let $rpl_connection_name= server3
--source include/rpl_connection.inc
--source include/stop_group_replication.inc
--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
--let $rpl_connection_name= server3
--source include/rpl_connection.inc
--source include/start_group_replication.inc
DROP TABLE t1;
--source include/group_replication_end.inc
|