| 1 |
################################################################################ |
| 2 |
# This test intends to test a recovery race condition against member changes. |
| 3 |
# When start and stops are done sequentially, there was a chance that recovery |
| 4 |
# would see a one member group and think it was alone declaring the node online |
| 5 |
# in the log |
| 6 |
# |
| 7 |
# Test: |
| 8 |
# 0. The test requires two servers: M1 and M2. |
| 9 |
# 1. Bootstrap start a group on M1. |
| 10 |
# 2. Set DEBUG point on M2 to wait right before the process decides if the |
| 11 |
# server is alone. Start GR on M2. Check member_state is RECOVERING. |
| 12 |
# 3. On another connection of M2 stop GR. |
| 13 |
# 4. Signal recovery to continue on M2. Check member_state is OFFLINE. |
| 14 |
# 5. To test everything is working fine, add data on M1 and start GR on M2. |
| 15 |
# Validate data on M2. |
| 16 |
# 6. Clean up. |
| 17 |
################################################################################ |
| 18 |
|
| 19 |
--source include/big_test.inc |
| 20 |
--source include/have_debug.inc |
| 21 |
--source include/have_debug_sync.inc |
| 22 |
--let $group_replication_group_name= 572e4320-cd68-11e4-8830-0800200c9a66 |
| 23 |
--source include/have_group_replication_plugin.inc |
| 24 |
--let $rpl_skip_group_replication_start= 1 |
| 25 |
|
| 26 |
--source include/group_replication.inc |
| 27 |
|
| 28 |
--echo # |
| 29 |
--echo # Start group replication on the first server |
| 30 |
--echo # |
| 31 |
|
| 32 |
--connection server1 |
| 33 |
--echo server1 |
| 34 |
--source include/start_and_bootstrap_group_replication.inc |
| 35 |
|
| 36 |
--echo # |
| 37 |
--echo # Start group replication on server 2 |
| 38 |
--echo # Wait right before the process decides if the server is alone. |
| 39 |
--echo # |
| 40 |
|
| 41 |
--connection server2 |
| 42 |
--echo server2 |
| 43 |
SET SESSION sql_log_bin= 0; |
| 44 |
call mtr.add_suppression("Error while sending message in the group replication incremental recovery process."); |
| 45 |
call mtr.add_suppression("Error while sending stats message"); |
| 46 |
SET SESSION sql_log_bin= 1; |
| 47 |
|
| 48 |
SET @debug_save= @@GLOBAL.DEBUG; |
| 49 |
|
| 50 |
--echo # Set the debug flag to block recovery |
| 51 |
SET @@GLOBAL.DEBUG='d,recovery_thread_start_wait_num_of_members'; |
| 52 |
|
| 53 |
--let $group_replication_start_member_state= RECOVERING |
| 54 |
--source include/start_group_replication.inc |
| 55 |
|
| 56 |
#sleep to give time for the start to get stuck on recovery |
| 57 |
--sleep 5 |
| 58 |
|
| 59 |
--echo # |
| 60 |
--echo # On another connection stop group replication on server 2 |
| 61 |
--echo # |
| 62 |
|
| 63 |
--connection slave |
| 64 |
--send |
| 65 |
STOP GROUP_REPLICATION; |
| 66 |
|
| 67 |
--echo # |
| 68 |
--echo # Continue with recovery. |
| 69 |
--echo # |
| 70 |
|
| 71 |
--connection server2 |
| 72 |
|
| 73 |
#sleep to give time for the stop to make the number of members go to 1 |
| 74 |
--sleep 5 |
| 75 |
|
| 76 |
SET DEBUG_SYNC= "now SIGNAL signal.recovery_continue"; |
| 77 |
SET @@GLOBAL.DEBUG= @debug_save; |
| 78 |
|
| 79 |
--connection slave |
| 80 |
--reap |
| 81 |
|
| 82 |
--let $group_replication_member_state= OFFLINE |
| 83 |
--source include/gr_wait_for_member_state.inc |
| 84 |
--source include/assert_and_disable_read_only.inc |
| 85 |
|
| 86 |
--echo # |
| 87 |
--echo # Test if the servers are working properly |
| 88 |
--echo # |
| 89 |
|
| 90 |
--connection server1 |
| 91 |
--echo server1 |
| 92 |
|
| 93 |
CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB; |
| 94 |
INSERT INTO t1 VALUES (1); |
| 95 |
|
| 96 |
--connection server2 |
| 97 |
--echo server2 |
| 98 |
--source include/start_group_replication.inc |
| 99 |
|
| 100 |
--let $assert_text= On the recovered member, the table should exist and have 1 elements; |
| 101 |
--let $assert_cond= [select count(*) from t1] = 1; |
| 102 |
--source include/assert.inc |
| 103 |
|
| 104 |
--echo # |
| 105 |
--echo # Clean up |
| 106 |
--echo # |
| 107 |
|
| 108 |
DROP TABLE t1; |
| 109 |
|
| 110 |
--source include/group_replication_end.inc |