Current Path : /usr/opt/mysql57/mysql-test/suite/group_replication/t/ |
FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64 |
Current File : //usr/opt/mysql57/mysql-test/suite/group_replication/t/gr_restart.test |
################################################################################ # 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 asan and valgrind. --source include/not_asan.inc --source include/not_valgrind.inc --source include/have_debug.inc --source include/force_restart.inc --let $group_replication_group_name= 8a94f357-aab4-11df-86ab-c80aa9429576 --source ../inc/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 ../inc/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 @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. STOP SLAVE SQL_THREAD FOR CHANNEL "group_replication_applier"; --connection server1 --let $group_replication_number_of_members= 2 --source ../inc/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 # 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 --let $_group_replication_local_address= `SELECT @@GLOBAL.group_replication_local_address` --let $_group_replication_group_seeds= `SELECT @@GLOBAL.group_replication_group_seeds` --let $_group_replication_group_whitelist= `SELECT @@GLOBAL.group_replication_ip_whitelist` --let $restart_parameters=restart:--group_replication_local_address=$_group_replication_local_address --group_replication_group_seeds=$_group_replication_group_seeds --group_replication_ip_whitelist=$_group_replication_group_whitelist --replace_result $_group_replication_local_address GROUP_REPLICATION_LOCAL_ADDRESS $_group_replication_group_seeds GROUP_REPLICATION_GROUP_SEEDS $_group_replication_group_whitelist GROUP_REPLICATION_GROUP_WHITELIST --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 --group_replication_ip_whitelist=$_group_replication_group_whitelist --replace_result $_group_replication_local_address GROUP_REPLICATION_LOCAL_ADDRESS $_group_replication_group_seeds GROUP_REPLICATION_GROUP_SEEDS $_group_replication_group_whitelist GROUP_REPLICATION_GROUP_WHITELIST --source ../inc/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 ../inc/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 ../inc/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 ../inc/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 ../inc/gr_clear_configuration.inc