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_single_primary_stop.test |
####################################################################################### # WL9426 : In a group of 3 or more servers:- # Just after stopping/crashing primary server, stop secondary member which is # probable to become a primary. Test that one of the available secondary member # becomes a primary member. # Test : # 0. This test requires 3 servers # 1. Create a group replication setup with 3 members # 2. Crash the primary member # 3. Wait for that server to go down and become unreachable # 4. Stop the group replication next probable primary which is secondary # 5. Bring back the server and set all the required group replication variables # 6. Test that the remained server which is ONLINE in the group becomes the primary. # 7. Perform some insert operations on the primary # 8. Bring back the servers in to group replication setup # 9. Wait for data to recover and validate the data and cleanup ####################################################################################### # Don't test this under valgrind, memory leaks will occur --source include/not_asan.inc --source include/not_valgrind.inc --source include/big_test.inc --source ../inc/have_group_replication_plugin.inc --let $rpl_server_count= 3 --let $rpl_skip_group_replication_start= 1 --let $rpl_group_replication_single_primary_mode=1 --source include/force_restart.inc --source ../inc/group_replication.inc # Start group replication on all the servers --source ../inc/start_and_bootstrap_group_replication.inc --let $member1_uuid= query_get_value(SELECT @@SERVER_UUID, @@SERVER_UUID, 1) # save this, since it will be used to recover the server later on --let $local_address_server1= `SELECT @@GLOBAL.group_replication_local_address` --let $group_seeds_server1= `SELECT @@GLOBAL.group_replication_group_seeds` --let $_group_replication_group_whitelist= `SELECT @@GLOBAL.group_replication_ip_whitelist` --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 --echo # --echo # Crash the primary server --let $rpl_connection_name= server1 --source include/rpl_connection.inc # Making sure this is the primary server --let $group_replication_expected_uuid= $member1_uuid --source ../inc/gr_wait_primary_member_uuid.inc # We do kill the servers, using shutdown_server 0, and then MTR will # follow the expect file and restart the server --enable_reconnect --exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --shutdown_server 0 --source include/wait_until_disconnected.inc --source include/wait_until_connected_again.inc --disable_reconnect # reset the group_replication_id var --let $group_replication_member_id= $member2_uuid --let $rpl_server_number= 1 --source include/rpl_reconnect.inc # Check that only 2 member is alive in the group on server 2 --let $rpl_connection_name= server_2 --source include/rpl_connection.inc --echo # wait for number of alive members to be 2 --let $group_replication_number_of_members= 2 --source ../inc/gr_wait_for_number_of_members.inc # Check that only 2 member is alive in the group on server 3 --let $rpl_connection_name= server_3 --source include/rpl_connection.inc --echo # wait for number of alive members to be 2 --let $group_replication_number_of_members= 2 --source ../inc/gr_wait_for_number_of_members.inc --let $rpl_connection_name= server_1 --source include/rpl_connection.inc --replace_result $group_seeds_server1 GROUP_SEEDS_SERVER1 --eval SET @@global.group_replication_group_seeds="$group_seeds_server1" --replace_result $local_address_server1 LOCAL_ADDRESS_SERVER1 --eval SET @@global.group_replication_local_address="$local_address_server1" --replace_result $group_replication_group_name GROUP_REPLICATION_GROUP_NAME --eval SET @@global.group_replication_group_name="$group_replication_group_name" --replace_result $_group_replication_group_whitelist GROUP_REPLICATION_GROUP_WHITELIST --eval SET @@global.group_replication_ip_whitelist="$_group_replication_group_whitelist" --eval SET @@global.group_replication_enforce_update_everywhere_checks=0 --eval SET @@global.group_replication_single_primary_mode=1 # Stop the secondary member which is probable to become a primary --let $rpl_connection_name= server2 --source include/rpl_connection.inc --source include/stop_group_replication.inc --let $rpl_connection_name= server3 --source include/rpl_connection.inc --let $server3_uuid= `SELECT @@server_uuid` --let $group_replication_expected_uuid= $server3_uuid --source ../inc/gr_wait_primary_member_uuid.inc CREATE TABLE test.t1 ( a int primary key); INSERT INTO test.t1 VALUES(1); # Start group replication again in server 1 and server 2 --let $rpl_connection_name= server2 --source include/rpl_connection.inc --source include/start_group_replication.inc --let $rpl_connection_name= server1 --source include/rpl_connection.inc --source include/start_group_replication.inc --let $wait_condition=SELECT COUNT(*)=3 FROM performance_schema.replication_group_members where MEMBER_STATE="ONLINE" --source include/wait_condition.inc --let $group_replication_expected_uuid= $server3_uuid --source ../inc/gr_wait_primary_member_uuid.inc # Connect to primary and cleanup --let $rpl_connection_name= server3 --source include/rpl_connection.inc DROP TABLE test.t1; --source ../inc/group_replication_end.inc