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
|
################################################################################
# Verify that when Group Replication is used, on server
# start the certifier's sequence number is loaded from the
# relay log (already certified transactions, if any) and from
# GTID_EXECUTED (applied transactions).
#
# Test:
# 0. The test requires two servers: M1 and M2.
# 1. Bootstrap start group on M1. Start GR on M2. Stop applier thread on M2.
# Create table and insert some data on M1.
# 2. Wait until M2 receives and certify the transactions. Restart server M2.
# Verify that certifier sequence number is set from relay log certified
# transactions and view change transactions.
# Set DEBUG point and start GR on M2.
# 3. On M2, try to insert duplicate entry. It must fail with duplicate entry.
# Insert non duplicate entry. It must pass.
# 4. Kill M2 again and verify that certifier sequence number is set from
# GTID_EXECUTED. Set DEBUG point and start GR on M2.
# 5. Shutdown.
################################################################################
# This test does crashes servers, thence we skip it on valgrind.
--source include/not_valgrind.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
--source include/force_restart.inc
--let $group_replication_group_name= 8a94f357-aab4-11df-86ab-c80aa9429576
--source include/have_group_replication_plugin.inc
--let $use_gtids=1
--let $wait_for_executed_gtid_set=1
--echo ############################################################
--echo # 1. Start servers, on which server2 has applier stopped so
--echo # that all remote transactions are only queued on relay log.
--echo # Execute some transactions on server1.
--connection server1
--source include/start_and_bootstrap_group_replication.inc
set session sql_log_bin=0;
call mtr.add_suppression("The member lost contact with a majority of the members in the group. Until the network is restored.*");
call mtr.add_suppression("The member resumed contact with a majority of the members in the group.*");
set session sql_log_bin=1;
--connection server2
SET SESSION sql_log_bin = 0;
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;
SET @debug_saved= @@GLOBAL.DEBUG;
--source include/start_group_replication.inc
--let $member2_uuid= query_get_value(SELECT @@SERVER_UUID, @@SERVER_UUID, 1)
# Do not apply certified remote transactions.
SET @@GLOBAL.DEBUG='+d,block_applier_updates';
--connection server1
--let $group_replication_number_of_members= 2
--source include/gr_wait_for_number_of_members.inc
CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
--echo
--echo #####################################################################
--echo # 2. Restart server2 and verify that certifier sequence number is set
--echo # from relay log certified transactions and view change transactions
--connection server2
SET DEBUG_SYNC = "now WAIT_FOR applier_read_blocked";
# Wait until server receives and certify the transactions.
--let $wait_condition= SELECT (Count_transactions_checked - Count_conflicts_detected) = 2 from performance_schema.replication_group_member_stats
--source include/wait_condition.inc
# Force GR to stop without commit the received transactions.
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';
--let $_group_replication_local_address= `SELECT @@GLOBAL.group_replication_local_address`
--let $_group_replication_group_seeds= `SELECT @@GLOBAL.group_replication_group_seeds`
--let $restart_parameters=restart:--group_replication_local_address=$_group_replication_local_address --group_replication_group_seeds=$_group_replication_group_seeds
--replace_result $_group_replication_local_address GROUP_REPLICATION_LOCAL_ADDRESS $_group_replication_group_seeds GROUP_REPLICATION_GROUP_SEEDS
--source include/restart_mysqld.inc
SET @@GLOBAL.DEBUG= '+d,certifier_assert_next_seqno_equal_5';
--source include/start_group_replication.inc
SET @@GLOBAL.DEBUG= @debug_saved;
--echo ############################################################
--echo # 3. Insert must fail with duplicate entry.
--error ER_DUP_ENTRY
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (2);
--echo
--echo ############################################################
--echo # 4. Kill server2 again and verify that certifier sequence
--echo # number is set from GTID_EXECUTED.
# kill server 2
--let $restart_parameters=restart:--group_replication_local_address=$_group_replication_local_address --group_replication_group_seeds=$_group_replication_group_seeds
--replace_result $_group_replication_local_address GROUP_REPLICATION_LOCAL_ADDRESS $_group_replication_group_seeds GROUP_REPLICATION_GROUP_SEEDS
--source include/kill_and_restart_mysqld.inc
#Needed as we are not using rpl_restart_server.inc
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--enable_reconnect
# Wait until group has only 1 member, that is, server2 death is detected by
# the group.
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--let $group_replication_member_state= UNREACHABLE
--let $group_replication_member_id= $member2_uuid
--source include/gr_wait_for_member_state.inc
# unblock the group, since server1 has gone away and
# there were only two in the group - majority lost
--let $local_address_server1= `SELECT @@GLOBAL.group_replication_local_address`
--disable_query_log
# Reseting the group to server1 only
--eval SET GLOBAL group_replication_force_members= "$local_address_server1"
--enable_query_log
--let $group_replication_number_of_members= 1
--source include/gr_wait_for_number_of_members.inc
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
SET @@GLOBAL.DEBUG= '+d,certifier_assert_next_seqno_equal_7';
--source include/start_group_replication.inc
SET @@GLOBAL.DEBUG= @debug_saved;
--echo
--echo ############################################################
--echo # 5. Shutdown.
--connection server1
--let $group_replication_number_of_members= 2
--source include/gr_wait_for_number_of_members.inc
DROP TABLE t1;
--let $sync_slave_connection= server2
--source include/sync_slave_sql_with_master.inc
--connection server1
--source include/stop_group_replication.inc
RESET SLAVE ALL FOR CHANNEL "group_replication_applier";
RESET MASTER;
--connection server2
--source include/stop_group_replication.inc
RESET SLAVE ALL FOR CHANNEL "group_replication_applier";
RESET MASTER;
--source include/gr_clear_configuration.inc
|