| 1 |
####################################################################################### |
| 2 |
# WL11570 - GR: options to defer member eviction after a suspicion |
| 3 |
# |
| 4 |
# In a group of 3 servers, we suspend one of them for 10 seconds and test if the |
| 5 |
# non-responding server remains in the group and for the configured waiting time, |
| 6 |
# instead of being immediately expelled. |
| 7 |
# Test : |
| 8 |
# 0. This test requires a group with 3 servers |
| 9 |
# 1. Set the group_replication_member_expel_timeout parameter to 300 seconds |
| 10 |
# 2. Create table t1 and insert some data, checking that it is replicated to all |
| 11 |
# servers. |
| 12 |
# 3. Suspend server 3 by sending a signal SIGSTOP to it. |
| 13 |
# This will make server 3 not answer to "I am alive" GCS messages and it will |
| 14 |
# eventually be considered faulty. |
| 15 |
# 4. Check that all members are still in the group on servers 1 and 2, which should |
| 16 |
# both be ONLINE. |
| 17 |
# Server 3 should still be in the group but UNREACHABLE. |
| 18 |
# 5. Insert data into table t1 on server 2 and check that it is replicated to server 1. |
| 19 |
# 6. After 10 seconds, resume server 3 by sending a signal SIGCONT to it. |
| 20 |
# After some time, its state should change to ONLINE. |
| 21 |
# 7. Check that server 3 retrieves the data inserted by server 2 while it was |
| 22 |
# suspended. |
| 23 |
# Then, insert new data into table t1 which should be replicated to servers 1 and 2. |
| 24 |
# 8. Clean up. |
| 25 |
####################################################################################### |
| 26 |
|
| 27 |
|
| 28 |
# Test involves sending SIGSTOP and SIGCONT signals using kill Linux command. |
| 29 |
--source include/not_valgrind.inc |
| 30 |
--source include/linux.inc |
| 31 |
--source include/big_test.inc |
| 32 |
--source include/force_restart.inc |
| 33 |
--source include/have_group_replication_plugin.inc |
| 34 |
--let $rpl_server_count= 3 |
| 35 |
--source include/group_replication.inc |
| 36 |
|
| 37 |
|
| 38 |
--echo |
| 39 |
--echo ############################################################ |
| 40 |
--echo # 1. Set group_replication_member_expel_timeout to |
| 41 |
--echo # 300 seconds. |
| 42 |
--let $rpl_connection_name= server1 |
| 43 |
--source include/rpl_connection.inc |
| 44 |
SET GLOBAL group_replication_member_expel_timeout = 300; |
| 45 |
SELECT @@GLOBAL.group_replication_member_expel_timeout; |
| 46 |
|
| 47 |
--let $rpl_connection_name= server2 |
| 48 |
--source include/rpl_connection.inc |
| 49 |
SET GLOBAL group_replication_member_expel_timeout = 300; |
| 50 |
SELECT @@GLOBAL.group_replication_member_expel_timeout; |
| 51 |
|
| 52 |
--let $rpl_connection_name= server3 |
| 53 |
--source include/rpl_connection.inc |
| 54 |
SET GLOBAL group_replication_member_expel_timeout = 300; |
| 55 |
SELECT @@GLOBAL.group_replication_member_expel_timeout; |
| 56 |
|
| 57 |
|
| 58 |
--echo |
| 59 |
--echo ############################################################ |
| 60 |
--echo # 2. Create a table and insert some data. Check that |
| 61 |
--echo # it is replicated to all servers. |
| 62 |
--let $rpl_connection_name= server1 |
| 63 |
--source include/rpl_connection.inc |
| 64 |
CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY); |
| 65 |
INSERT INTO t1 VALUES (1); |
| 66 |
--source include/rpl_sync.inc |
| 67 |
|
| 68 |
|
| 69 |
--echo |
| 70 |
--echo ############################################################ |
| 71 |
--echo # 3. Suspend server 3 by sending signal SIGSTOP to it. |
| 72 |
--echo # This will make server 3 not answer to "I am alive" |
| 73 |
--echo # GCS messages and it will eventually be considered |
| 74 |
--echo # faulty. |
| 75 |
--let $rpl_connection_name= server3 |
| 76 |
--source include/rpl_connection.inc |
| 77 |
|
| 78 |
--echo # Get server 3 pid. |
| 79 |
SET SESSION sql_log_bin= 0; |
| 80 |
CREATE TABLE pid_table(pid_no INT); |
| 81 |
--let $pid_file= `SELECT @@GLOBAL.pid_file` |
| 82 |
--replace_result $pid_file pid_file |
| 83 |
--eval LOAD DATA LOCAL INFILE '$pid_file' INTO TABLE pid_table |
| 84 |
--let $server_pid=`SELECT pid_no FROM pid_table` |
| 85 |
DROP TABLE pid_table; |
| 86 |
SET SESSION sql_log_bin= 1; |
| 87 |
|
| 88 |
--echo # Suspending server 3... |
| 89 |
--exec kill -19 $server_pid |
| 90 |
|
| 91 |
|
| 92 |
--echo |
| 93 |
--echo ############################################################ |
| 94 |
--echo # 4. Check that all members are still in the group on |
| 95 |
--echo # servers 1 and 2, which should both be ONLINE. |
| 96 |
--echo # Server 3 should still be in the group but UNREACHABLE. |
| 97 |
--let $rpl_connection_name= server1 |
| 98 |
--source include/rpl_connection.inc |
| 99 |
let $wait_condition=SELECT COUNT(*)=2 FROM performance_schema.replication_group_members where MEMBER_STATE="ONLINE"; |
| 100 |
--source include/wait_condition.inc |
| 101 |
let $wait_condition=SELECT COUNT(*)=1 FROM performance_schema.replication_group_members where MEMBER_STATE="UNREACHABLE"; |
| 102 |
--source include/wait_condition.inc |
| 103 |
|
| 104 |
--let $rpl_connection_name= server2 |
| 105 |
--source include/rpl_connection.inc |
| 106 |
let $wait_condition=SELECT COUNT(*)=2 FROM performance_schema.replication_group_members where MEMBER_STATE="ONLINE"; |
| 107 |
--source include/wait_condition.inc |
| 108 |
let $wait_condition=SELECT COUNT(*)=1 FROM performance_schema.replication_group_members where MEMBER_STATE="UNREACHABLE"; |
| 109 |
--source include/wait_condition.inc |
| 110 |
|
| 111 |
|
| 112 |
--echo |
| 113 |
--echo ############################################################ |
| 114 |
--echo # 5. Insert data into table t1 on server 2 and check that |
| 115 |
--echo # it is replicated to server 1. |
| 116 |
INSERT INTO t1 VALUES (2); |
| 117 |
let $wait_condition=SELECT COUNT(*)=2 FROM t1; |
| 118 |
--source include/wait_condition.inc |
| 119 |
|
| 120 |
--let $rpl_connection_name= server1 |
| 121 |
--source include/rpl_connection.inc |
| 122 |
let $wait_condition=SELECT COUNT(*)=2 FROM t1; |
| 123 |
--source include/wait_condition.inc |
| 124 |
|
| 125 |
|
| 126 |
--echo |
| 127 |
--echo ############################################################ |
| 128 |
--echo # 6. Resume server 3 by sending a signal SIGCONT to it. |
| 129 |
--echo # Server should change to ONLINE state. |
| 130 |
--let $rpl_connection_name= server3 |
| 131 |
--source include/rpl_connection.inc |
| 132 |
--echo # Send signal SIGCONT to server 3. |
| 133 |
--exec kill -18 $server_pid |
| 134 |
|
| 135 |
--let $rpl_connection_name= server1 |
| 136 |
--source include/rpl_connection.inc |
| 137 |
let $wait_condition=SELECT COUNT(*)=3 FROM performance_schema.replication_group_members where MEMBER_STATE="ONLINE"; |
| 138 |
--source include/wait_condition.inc |
| 139 |
|
| 140 |
--let $rpl_connection_name= server2 |
| 141 |
--source include/rpl_connection.inc |
| 142 |
let $wait_condition=SELECT COUNT(*)=3 FROM performance_schema.replication_group_members where MEMBER_STATE="ONLINE"; |
| 143 |
--source include/wait_condition.inc |
| 144 |
|
| 145 |
--let $rpl_connection_name= server3 |
| 146 |
--source include/rpl_connection.inc |
| 147 |
let $wait_condition=SELECT COUNT(*)=3 FROM performance_schema.replication_group_members where MEMBER_STATE="ONLINE"; |
| 148 |
--source include/wait_condition.inc |
| 149 |
|
| 150 |
|
| 151 |
--echo |
| 152 |
--echo ############################################################ |
| 153 |
--echo # 7. Check that server 3 retrieves the data inserted while |
| 154 |
--echo # it was suspended. Then, insert new data into table t1 |
| 155 |
--echo # which should be replicated to servers 1 and 2. |
| 156 |
--let $rpl_connection_name= server3 |
| 157 |
--source include/rpl_connection.inc |
| 158 |
let $wait_condition=SELECT COUNT(*)=2 FROM t1; |
| 159 |
--source include/wait_condition.inc |
| 160 |
INSERT INTO t1 VALUES (3); |
| 161 |
--source include/rpl_sync.inc |
| 162 |
--let $diff_tables=server1:t1, server2:t1, server3:t1 |
| 163 |
--source include/diff_tables.inc |
| 164 |
|
| 165 |
|
| 166 |
--echo |
| 167 |
--echo ############################################################ |
| 168 |
--echo # 8. Clean up. |
| 169 |
DROP TABLE t1; |
| 170 |
|
| 171 |
--source include/group_replication_end.inc |