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_recovery_slave_commands.test |
############################################################################### # BUG 21626827 - SOME COMMAND SHOULD NOT BE ALLOWED FOR CHANNEL # 'GROUP_REPLICATION_RECOVERY' # # This test checks to see that user should not be allowed to execute # set of commands for the group_replication_recovery channel. # # Bug 23591186 - WL#9053 : MODIFY MTR TESTS TO VERIFY BEHAVIOR OF # 'GROUP_REPLICATION_RECOVERY' # The test is extended to check the behavior when MEMBER is in RECOVERING, # ONLINE, OFFLINE states. # # The commands being checked here are : # 1. START SLAVE IO_THREAD # 2. STOP SLAVE IO_THREAD # 3. START SLAVE FOR CHANNEL # 4. STOP SLAVE FOR CHANNEL # 5. START SLAVE SQL_THREAD # 6. STOP SLAVE SQL_THREAD # 7. SHOW SLAVE STATUS # 8. SHOW RELAYLOG EVENTS # 9. FLUSH RELAY LOGS # 10. RESET SLAVE # 11. RESET SLAVE ALL # # Test: # 0. The test requires two servers: M1 and M2. # # 1. Bootstrap start GR on M1. Test above mentioned 11 RPL(slave) commands # for recovery channel:- # - MEMBER_STATE: ONLINE and recovery channel is ABSENT. # - Expect ER_SLAVE_CHANNEL_DOES_NOT_EXIST. # # 2. Add some data for recovery on M1. Start GR on M2. Test above mentioned # 11 RPL(slave) commands for recovery channel:- # - MEMBER_STATE: ONLINE and recovery channel is PRESENT but INACTIVE. # - Expect ER_SLAVE_CHANNEL_OPERATION_NOT_ALLOWED in most of the cases. # # 3. Stop GR on M2. Add data on M1. Lock table on M2 to block recovery. # Start GR on M2. # # 4. Now when M2 is in RECOVERING state, test above mentioned 11 RPL(slave) # commands on recovery channel:- # - MEMBER_STATE: RECOVERING and recovery channel is ACTIVE. # - Expect ER_SLAVE_CHANNEL_OPERATION_NOT_ALLOWED in most of the cases. # # 5. Unlock tables on M2 and drop table t1 on M1. Stop GR on M2. Test above # mentioned 11 RPL(slave) commands:- # - MEMBER_STATE: OFFLINE and recovery channel is PRESENT but INACTIVE. # - Expect ER_SLAVE_CHANNEL_OPERATION_NOT_ALLOWED in most of the cases. ############################################################################### # Skip configuration of recovery channel --let $skip_recovery_configuration = 1 --source ../inc/have_group_replication_plugin.inc --let $rpl_skip_group_replication_start= 1 --source ../inc/group_replication.inc # Phase 1 --echo --echo # Bootstrap start GR on M1 and test commands for recovery channel --echo # when MEMBER_STATE: ONLINE and recovery channel is ABSENT --let $rpl_connection_name= server1 --source include/rpl_connection.inc set session sql_log_bin=0; call mtr.add_suppression("Slave channel 'group_replication_recovery' does not exist.*"); set session sql_log_bin=1; --source ../inc/start_and_bootstrap_group_replication.inc --echo --echo # CHM for 'group_replication_recovery' channel won't accept parameters other than --echo # MASTER_USER and MASTER_PASSWORD --error ER_SLAVE_CHANNEL_OPERATION_NOT_ALLOWED CHANGE MASTER TO MASTER_HOST="localhost", MASTER_PORT=10 FOR CHANNEL "group_replication_recovery"; --echo --echo # ERROR when executing STOP SLAVE on GR recovery channel --error ER_SLAVE_CHANNEL_DOES_NOT_EXIST STOP SLAVE FOR CHANNEL 'group_replication_recovery'; --echo --echo # ERROR when executing START SLAVE on GR recovery channel --error ER_SLAVE_CHANNEL_DOES_NOT_EXIST START SLAVE FOR CHANNEL 'group_replication_recovery'; --echo --echo # ERROR when executing STOP SLAVE IO_THREAD on GR recovery channel --error ER_SLAVE_CHANNEL_DOES_NOT_EXIST STOP SLAVE IO_THREAD FOR CHANNEL 'group_replication_recovery'; --echo --echo # ERROR when executing START SLAVE IO_THREAD on GR recovery channel --error ER_SLAVE_CHANNEL_DOES_NOT_EXIST START SLAVE IO_THREAD FOR CHANNEL 'group_replication_recovery'; --echo --echo # ERROR when executing STOP SLAVE SQL_THREAD on GR recovery channel --error ER_SLAVE_CHANNEL_DOES_NOT_EXIST STOP SLAVE SQL_THREAD FOR CHANNEL 'group_replication_recovery'; --echo --echo # ERROR when executing START SLAVE SQL_THREAD on GR recovery channel --error ER_SLAVE_CHANNEL_DOES_NOT_EXIST START SLAVE SQL_THREAD FOR CHANNEL 'group_replication_recovery'; --echo --echo # 'Empty set' when executing SHOW SLAVE STATUS on GR recovery channel --query_vertical SHOW SLAVE STATUS FOR CHANNEL 'group_replication_recovery' --echo --echo # ERROR when executing SHOW RELAYLOG EVENTS on GR recovery channel --error ER_SLAVE_CHANNEL_DOES_NOT_EXIST SHOW RELAYLOG EVENTS FOR CHANNEL 'group_replication_recovery'; --echo --echo # ERROR when executing FLUSH RELAY LOGS on GR recovery channel --error ER_SLAVE_CHANNEL_DOES_NOT_EXIST FLUSH RELAY LOGS FOR CHANNEL 'group_replication_recovery'; --echo --echo # ERROR when executing RESET SLAVE command on GR recovery channel --error ER_SLAVE_CHANNEL_DOES_NOT_EXIST RESET SLAVE FOR CHANNEL "group_replication_recovery"; --echo --echo # ERROR when executing RESET SLAVE ALL command on GR recovery channel --error ER_SLAVE_CHANNEL_DOES_NOT_EXIST RESET SLAVE ALL FOR CHANNEL "group_replication_recovery"; # Phase 2 --echo --echo # Add some data for recovery on M1. Start GR on M2. CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB; INSERT INTO t1 VALUES (1); --let $rpl_connection_name= server2 --source include/rpl_connection.inc set session sql_log_bin=0; call mtr.add_suppression("Transaction cannot be executed while Group Replication is recovering.*"); call mtr.add_suppression("Run function 'before_commit' in plugin 'group_replication' failed"); set session sql_log_bin=1; --disable_warnings CHANGE MASTER TO MASTER_USER="root" FOR CHANNEL "group_replication_recovery"; --enable_warnings --source include/start_group_replication.inc --let $wait_condition= SELECT COUNT(*)=1 FROM performance_schema.replication_connection_status where CHANNEL_NAME="group_replication_recovery" and SERVICE_STATE="OFF" --source include/wait_condition.inc --echo --echo # Test commands for recovery channel when MEMBER_STATE: ONLINE and --echo # recovery channel is PRESENT but INACTIVE. --echo --echo # STOP SLAVE is blocked on GR recovery channel --error ER_SLAVE_CHANNEL_OPERATION_NOT_ALLOWED STOP SLAVE FOR CHANNEL "group_replication_recovery"; --echo --echo # START SLAVE is blocked on GR recovery channel --error ER_SLAVE_CHANNEL_OPERATION_NOT_ALLOWED START SLAVE FOR CHANNEL 'group_replication_recovery'; --echo --echo # STOP SLAVE IO_THREAD is blocked on GR recovery channel --error ER_SLAVE_CHANNEL_OPERATION_NOT_ALLOWED STOP SLAVE IO_THREAD FOR CHANNEL 'group_replication_recovery'; --echo --echo # START SLAVE IO_THREAD is blocked on GR recovery channel --error ER_SLAVE_CHANNEL_OPERATION_NOT_ALLOWED START SLAVE IO_THREAD FOR CHANNEL 'group_replication_recovery'; --echo --echo # STOP SLAVE SQL_THREAD is blocked on GR recovery channel --error ER_SLAVE_CHANNEL_OPERATION_NOT_ALLOWED STOP SLAVE SQL_THREAD FOR CHANNEL 'group_replication_recovery'; --echo --echo # START SLAVE SQL_THREAD is blocked on GR recovery channel --error ER_SLAVE_CHANNEL_OPERATION_NOT_ALLOWED START SLAVE SQL_THREAD FOR CHANNEL 'group_replication_recovery'; --echo --echo # SHOW SLAVE STATUS - check that recovery channel is inactive --let $io_thread = query_get_value(SHOW SLAVE STATUS FOR CHANNEL 'group_replication_recovery', Slave_IO_Running, 1) --let $assert_text= recovery channel is inactive --let $assert_cond= "$io_thread" = "No" --source include/assert.inc --echo --echo # SHOW RELAYLOG EVENTS - check that relaylogs are created --let $relay_log_name= query_get_value(SHOW RELAYLOG EVENTS FOR CHANNEL 'group_replication_recovery', Log_name, 1) --let $assert_text= Relay logs are created --let $assert_cond= "$relay_log_name" <> "" --source include/assert.inc --echo --echo # SUCCESS when executing FLUSH RELAY LOGS on GR recovery channel FLUSH RELAY LOGS FOR CHANNEL 'group_replication_recovery'; --echo --echo # SUCCESS when executing RESET SLAVE on GR recovery channel RESET SLAVE FOR CHANNEL "group_replication_recovery"; --echo --echo # Execute RESET SLAVE ALL FOR CHANNEL to delete the recovery channel --echo # and related files RESET SLAVE ALL FOR CHANNEL "group_replication_recovery"; # Phase 3 --echo --echo # Stop GR on M2. Add data on M1. Lock table on M2 to block recovery. --echo # Start GR on M2. # Stop group replication and lock table t1 on server 2 to block recovery. --let $rpl_connection_name= server2 --source include/rpl_connection.inc --source include/stop_group_replication.inc --let $rpl_connection_name= server1 --source include/rpl_connection.inc INSERT INTO t1 VALUES (2); INSERT INTO t1 VALUES (3); # Lock the table in a different connection --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 --disable_warnings CHANGE MASTER TO MASTER_USER="root" FOR CHANNEL "group_replication_recovery"; --enable_warnings --echo --echo # Ensure that M2 is blocked in recovery stage so channel exists --let $group_replication_start_member_state= RECOVERING --source include/start_group_replication.inc --let $wait_timeout= 60 --let $wait_condition= SELECT COUNT(*)=1 FROM performance_schema.replication_connection_status where CHANNEL_NAME="group_replication_recovery" and SERVICE_STATE="ON" --source include/wait_condition.inc # Phase 4 --echo --echo # Now when M2 is in RECOVERING state, test commands for recovery channel --echo # when MEMBER_STATE: RECOVERING and recovery channel is ACTIVE. --echo --echo # STOP SLAVE is blocked on GR recovery channel --error ER_SLAVE_CHANNEL_OPERATION_NOT_ALLOWED STOP SLAVE FOR CHANNEL "group_replication_recovery"; --echo --echo # START SLAVE is blocked on GR recovery channel --error ER_SLAVE_CHANNEL_OPERATION_NOT_ALLOWED START SLAVE FOR CHANNEL 'group_replication_recovery'; --echo --echo # STOP SLAVE IO_THREAD is blocked on GR recovery channel --error ER_SLAVE_CHANNEL_OPERATION_NOT_ALLOWED STOP SLAVE IO_THREAD FOR CHANNEL 'group_replication_recovery'; --echo --echo # START SLAVE IO_THREAD is blocked on GR recovery channel --error ER_SLAVE_CHANNEL_OPERATION_NOT_ALLOWED START SLAVE IO_THREAD FOR CHANNEL 'group_replication_recovery'; --echo --echo # START SLAVE IO_THREAD with UNTIL option is blocked on GR recovery channel --error ER_SLAVE_CHANNEL_OPERATION_NOT_ALLOWED START SLAVE IO_THREAD UNTIL MASTER_LOG_FILE = 'server-binary-log.000001', MASTER_LOG_POS = 754 FOR CHANNEL 'group_replication_recovery'; --echo --echo # STOP SLAVE SQL_THREAD is blocked on GR recovery channel --error ER_SLAVE_CHANNEL_OPERATION_NOT_ALLOWED STOP SLAVE SQL_THREAD FOR CHANNEL 'group_replication_recovery'; --echo --echo # START SLAVE SQL_THREAD is blocked on GR recovery channel --error ER_SLAVE_CHANNEL_OPERATION_NOT_ALLOWED START SLAVE SQL_THREAD FOR CHANNEL 'group_replication_recovery'; --echo --echo # START SLAVE SQL_THREAD with UNTIL option is blocked on GR recovery channel --error ER_SLAVE_CHANNEL_OPERATION_NOT_ALLOWED START SLAVE SQL_THREAD UNTIL SQL_AFTER_GTIDS='11111111-1111-1111-1111-111111111111:1-23' FOR CHANNEL 'group_replication_recovery'; --echo --echo # START SLAVE SQL_THREAD with UNTIL option is blocked on GR recovery channel --error ER_SLAVE_CHANNEL_OPERATION_NOT_ALLOWED START SLAVE SQL_THREAD UNTIL RELAY_LOG_FILE = 'server-relay-log-group_replication_recovery.000001', RELAY_LOG_POS = 854 FOR CHANNEL 'group_replication_recovery'; --echo --echo # SHOW SLAVE STATUS - check that recovery channel is active --let $io_thread = query_get_value(SHOW SLAVE STATUS FOR CHANNEL 'group_replication_recovery', Slave_IO_Running, 1) --let $assert_text= recovery channel is active --let $assert_cond= "$io_thread" = "Yes" --source include/assert.inc --echo --echo # SHOW RELAYLOG EVENTS - Relay log files should exists --let $relay_log_name= query_get_value(SHOW RELAYLOG EVENTS FOR CHANNEL 'group_replication_recovery', Log_name, 1) --let $assert_text= Relay log name should not be empty as the command successfully executed. --let $assert_cond= "$relay_log_name" <> "" --source include/assert.inc # Bug#23575646 : FLUSH RELAY LOGS SHOULD HIT ERROR 3139 WHEN SERVER STATE IS RECOVERING --echo --echo # ERROR when executing FLUSH RELAY LOGS on GR recovery channel --error ER_RUN_HOOK_ERROR FLUSH RELAY LOGS FOR CHANNEL 'group_replication_recovery'; --echo --echo # RESET SLAVE command is blocked only when recovery channel is active. --error ER_SLAVE_CHANNEL_MUST_STOP RESET SLAVE FOR CHANNEL "group_replication_recovery"; --echo --echo # RESET SLAVE [ALL] command is blocked only when recovery channel is active. --error ER_SLAVE_CHANNEL_MUST_STOP RESET SLAVE ALL FOR CHANNEL "group_replication_recovery"; # Phase 5 --echo --echo # Unlock tables on M2 and drop table t1 on M1. Stop GR on M2. Test --echo # for recovery channel when MEMBER_STATE: OFFLINE and recovery channel --echo # is PRESENT but INACTIVE. --let $rpl_connection_name= server_2 --source include/rpl_connection.inc UNLOCK TABLES; --let $rpl_connection_name= server1 --source include/rpl_connection.inc DROP TABLE t1; --source include/rpl_sync.inc --let $rpl_connection_name= server2 --source include/rpl_connection.inc --source include/stop_group_replication.inc --echo --echo # STOP SLAVE is blocked on GR recovery channel --error ER_SLAVE_CHANNEL_OPERATION_NOT_ALLOWED STOP SLAVE FOR CHANNEL "group_replication_recovery"; --echo --echo # START SLAVE is blocked on GR recovery channel --error ER_SLAVE_CHANNEL_OPERATION_NOT_ALLOWED START SLAVE FOR CHANNEL 'group_replication_recovery'; --echo --echo # STOP SLAVE IO_THREAD is blocked on GR recovery channel --error ER_SLAVE_CHANNEL_OPERATION_NOT_ALLOWED STOP SLAVE IO_THREAD FOR CHANNEL 'group_replication_recovery'; --echo --echo # START SLAVE IO_THREAD is blocked on GR recovery channel --error ER_SLAVE_CHANNEL_OPERATION_NOT_ALLOWED START SLAVE IO_THREAD FOR CHANNEL 'group_replication_recovery'; --echo --echo # STOP SLAVE SQL_THREAD is blocked on GR recovery channel --error ER_SLAVE_CHANNEL_OPERATION_NOT_ALLOWED STOP SLAVE SQL_THREAD FOR CHANNEL 'group_replication_recovery'; --echo --echo # START SLAVE SQL_THREAD is blocked on GR recovery channel --error ER_SLAVE_CHANNEL_OPERATION_NOT_ALLOWED START SLAVE SQL_THREAD FOR CHANNEL 'group_replication_recovery'; --echo --echo # SHOW SLAVE STATUS - check that recovery channel is inactive --let $io_thread = query_get_value(SHOW SLAVE STATUS FOR CHANNEL 'group_replication_recovery', Slave_IO_Running, 1) --let $assert_text= recovery channel is inactive --let $assert_cond= "$io_thread" = "No" --source include/assert.inc --echo --echo # SHOW RELAYLOG EVENTS - check that relaylogs are not deleted --let $relay_log_name= query_get_value(SHOW RELAYLOG EVENTS FOR CHANNEL 'group_replication_recovery', Log_name, 1) --let $assert_text= Relay logs are not deleted --let $assert_cond= "$relay_log_name" <> "" --source include/assert.inc --echo --echo # Execute RESET SLAVE ALL FOR CHANNEL to delete the recovery channel --echo # and related files RESET SLAVE ALL FOR CHANNEL "group_replication_recovery"; --echo --echo # ERROR when executing RESET SLAVE on GR recovery channel --error ER_SLAVE_CHANNEL_DOES_NOT_EXIST RESET SLAVE FOR CHANNEL "group_replication_recovery"; --echo --echo # ERROR when executing FLUSH RELAY LOGS on GR recovery channel --error ER_SLAVE_CHANNEL_DOES_NOT_EXIST FLUSH RELAY LOGS FOR CHANNEL 'group_replication_recovery'; --source ../inc/group_replication_end.inc