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_network_partition_handling.test |
################################################################################ # Verify that when a member is blocked on a minority and waiting on a blocked # query, group replication will kill all transactions after a while and leave # the group enabling super read mode. # Steps: # 0) The test requires three servers: M1, M2 and M3. # 1) Create a group with 3 members. # 2) Check the group_replication_unreachable_majority_timeout var boundaries # 2.1) Check min value of group_replication_unreachable_majority_timeout # 2.1) Check max value of group_replication_unreachable_majority_timeout # 3) Create a minority situation with only 1 member alive: M1 # Assert M2 and M3 are unreachable # 4) Execute a query on M1 that will block # 5) Wait a minute and assert # * member state is ERROR # * super read only mode is ON # * the query rolled back # 6) Clean up. ################################################################################ # Don't test this under valgrind, memory leaks will occur --source include/not_valgrind.inc --source include/big_test.inc --source include/force_restart.inc --source ../inc/have_group_replication_plugin.inc --echo # --echo # 1. Create a group with 3 members --echo # Extract each server uuid --echo # Create a table on it. --echo # --let $rpl_server_count= 3 --source ../inc/group_replication.inc --let $rpl_connection_name= server1 --source include/rpl_connection.inc --let $member1_uuid= query_get_value(SELECT @@SERVER_UUID, @@SERVER_UUID, 1) --let $local_address_server1= `SELECT @@GLOBAL.group_replication_local_address` --let $rpl_connection_name= server2 --source include/rpl_connection.inc --let $member2_uuid= query_get_value(SELECT @@SERVER_UUID, @@SERVER_UUID, 1) --let $rpl_connection_name= server3 --source include/rpl_connection.inc --let $member3_uuid= query_get_value(SELECT @@SERVER_UUID, @@SERVER_UUID, 1) CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB; --source include/rpl_sync.inc --echo # --echo # 2. Check group_replication_unreachable_majority_timeout boundaries --echo # --let $rpl_connection_name= server1 --source include/rpl_connection.inc --let $saved_unr_timeout= `SELECT @@GLOBAL.group_replication_unreachable_majority_timeout` --echo # 2.1. Set group_replication_unreachable_majority_timeout below min value SET @@GLOBAL.group_replication_unreachable_majority_timeout= -1; --echo # 2.1. Check min value of group_replication_unreachable_majority_timeout --let $assert_text= Minimum group_replication_unreachable_majority_timeout is 0 --let $assert_cond= "[SELECT @@GLOBAL.group_replication_unreachable_majority_timeout]" = 0 --source include/assert.inc --echo # 2.2. Set group_replication_unreachable_majority_timeout above max value. SET @@GLOBAL.group_replication_unreachable_majority_timeout= 31536001; --echo # 2.2. Check max value of group_replication_unreachable_majority_timeout. --let $assert_text= Maximum group_replication_unreachable_majority_timeout is 31536000 --let $assert_cond= "[SELECT @@GLOBAL.group_replication_unreachable_majority_timeout]" = 31536000 # Set a low value for the test SET @@GLOBAL.group_replication_unreachable_majority_timeout= 11; --echo # --echo # 3. Crash server 2 and server 3 --echo # Check they are marked as unreachable --echo # # We do kill the servers, using shutdown_server 0, and then MTR will # follow the expect file and restart the server, but we do not wait # for the server restart. # Since the servers loose its GCS configuration them will not rejoin # the group. --let $rpl_connection_name= server2 --source include/rpl_connection.inc --exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.2.expect --shutdown_server 0 --source include/wait_until_disconnected.inc --let $rpl_connection_name= server3 --source include/rpl_connection.inc --exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.3.expect --shutdown_server 0 --source include/wait_until_disconnected.inc --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 --let $group_replication_member_state= UNREACHABLE --let $group_replication_member_id= $member3_uuid --source ../inc/gr_wait_for_member_state.inc --let $group_replication_member_id= $member1_uuid --echo # --echo # 4. Execute a query that will block --echo # --send INSERT INTO t1 VALUES (2) --echo # --echo # 5. After some seconds the member should go into error mode. --echo # It should enable super read only mode and kill pending transactions. --echo # --let $rpl_connection_name= server_1 --source include/rpl_connection.inc # verify thread THD_group_partition_handler has started --let $wait_condition= SELECT COUNT(*)=1 FROM performance_schema.threads WHERE NAME = "thread/group_rpl/THD_group_partition_handler" --source include/wait_condition.inc --let $group_replication_member_state= ERROR --source ../inc/gr_wait_for_member_state.inc --let $rpl_connection_name= server1 --source include/rpl_connection.inc --error ER_TRANSACTION_ROLLBACK_DURING_COMMIT --reap --echo # The server's read_only mode should be enabled --let $assert_text= The super_read_only mode should be 1. --let $assert_cond= "[SELECT @@GLOBAL.super_read_only]" = 1; --source include/assert.inc --echo # --echo # 6. Clean up. --echo # --source include/stop_group_replication.inc --let $rpl_connection_name= server1 --source include/rpl_connection.inc DROP TABLE t1; --disable_query_log --eval SET @@GLOBAL.group_replication_unreachable_majority_timeout= $saved_unr_timeout --enable_query_log 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("'This member could not reach a majority of the members for more than.*"); call mtr.add_suppression("The server was automatically set into read only mode after an error was detected."); call mtr.add_suppression("Due to a plugin error, some transactions can't be certified and will now rollback."); call mtr.add_suppression("Skipping leave operation: concurrent attempt to leave the group is on-going."); call mtr.add_suppression("Timeout while waiting for the group communication engine to exit!"); call mtr.add_suppression("The member has failed to gracefully leave the group."); call mtr.add_suppression("read failed"); set session sql_log_bin=1; --let $rpl_connection_name= server_2 --source include/rpl_connection.inc --let $rpl_server_number= 2 --source include/rpl_reconnect.inc DROP TABLE t1; --let $rpl_connection_name= server_3 --source include/rpl_connection.inc --let $rpl_server_number= 3 --source include/rpl_reconnect.inc DROP TABLE t1; --source ../inc/group_replication_end.inc