polardbxengine/mysql-test/suite/group_replication/t/gr_start_stop_recovery.test

111 lines
3.1 KiB
Plaintext

################################################################################
# This test intends to test a recovery race condition against member changes.
# When start and stops are done sequentially, there was a chance that recovery
# would see a one member group and think it was alone declaring the node online
# in the log
#
# Test:
# 0. The test requires two servers: M1 and M2.
# 1. Bootstrap start a group on M1.
# 2. Set DEBUG point on M2 to wait right before the process decides if the
# server is alone. Start GR on M2. Check member_state is RECOVERING.
# 3. On another connection of M2 stop GR.
# 4. Signal recovery to continue on M2. Check member_state is OFFLINE.
# 5. To test everything is working fine, add data on M1 and start GR on M2.
# Validate data on M2.
# 6. Clean up.
################################################################################
--source include/big_test.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
--let $group_replication_group_name= 572e4320-cd68-11e4-8830-0800200c9a66
--source include/have_group_replication_plugin.inc
--let $rpl_skip_group_replication_start= 1
--source include/group_replication.inc
--echo #
--echo # Start group replication on the first server
--echo #
--connection server1
--echo server1
--source include/start_and_bootstrap_group_replication.inc
--echo #
--echo # Start group replication on server 2
--echo # Wait right before the process decides if the server is alone.
--echo #
--connection server2
--echo server2
SET SESSION sql_log_bin= 0;
call mtr.add_suppression("Error while sending message in the group replication incremental recovery process.");
call mtr.add_suppression("Error while sending stats message");
SET SESSION sql_log_bin= 1;
SET @debug_save= @@GLOBAL.DEBUG;
--echo # Set the debug flag to block recovery
SET @@GLOBAL.DEBUG='d,recovery_thread_start_wait_num_of_members';
--let $group_replication_start_member_state= RECOVERING
--source include/start_group_replication.inc
#sleep to give time for the start to get stuck on recovery
--sleep 5
--echo #
--echo # On another connection stop group replication on server 2
--echo #
--connection slave
--send
STOP GROUP_REPLICATION;
--echo #
--echo # Continue with recovery.
--echo #
--connection server2
#sleep to give time for the stop to make the number of members go to 1
--sleep 5
SET DEBUG_SYNC= "now SIGNAL signal.recovery_continue";
SET @@GLOBAL.DEBUG= @debug_save;
--connection slave
--reap
--let $group_replication_member_state= OFFLINE
--source include/gr_wait_for_member_state.inc
--source include/assert_and_disable_read_only.inc
--echo #
--echo # Test if the servers are working properly
--echo #
--connection server1
--echo server1
CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
--connection server2
--echo server2
--source include/start_group_replication.inc
--let $assert_text= On the recovered member, the table should exist and have 1 elements;
--let $assert_cond= [select count(*) from t1] = 1;
--source include/assert.inc
--echo #
--echo # Clean up
--echo #
DROP TABLE t1;
--source include/group_replication_end.inc