| 1 |
################################################################################ |
| 2 |
# This test verifies that START GROUP_REPLICATION blocked |
| 3 |
# due to disk full can be killed and unblocked. |
| 4 |
# |
| 5 |
# Test: |
| 6 |
# 0. The test requires two servers M1 & M2 |
| 7 |
# 1. Setup GR environment and get thread id |
| 8 |
# of the query which will be killed. |
| 9 |
# 2. Block START GR with no disk space. |
| 10 |
# 3. Verify START GR is blocked. |
| 11 |
# 4. Kill the blocked START GR command. |
| 12 |
# 5. Reap the killed command and reset debug point. |
| 13 |
# 6. Verify member is still OFFLINE |
| 14 |
# 7. Verify no more thread is waiting for disk space |
| 15 |
# 8. Restart group_replication on server1 and server2. |
| 16 |
# 9. Add some data to server1. |
| 17 |
# 10. Verify data is replicated to the group. |
| 18 |
# 11. Clean up |
| 19 |
################################################################################ |
| 20 |
|
| 21 |
--source include/big_test.inc |
| 22 |
--source include/have_debug.inc |
| 23 |
--source include/have_group_replication_plugin.inc |
| 24 |
--let $rpl_skip_group_replication_start= 1 |
| 25 |
--source include/group_replication.inc |
| 26 |
|
| 27 |
--echo |
| 28 |
--echo # 1. Setup GR environment and get thread id |
| 29 |
--echo # of the query which will be killed. |
| 30 |
--echo |
| 31 |
--let $rpl_connection_name= server1 |
| 32 |
--source include/rpl_connection.inc |
| 33 |
|
| 34 |
# We RESET the channel here due to Bug#31541607. By executing this command |
| 35 |
# here, we avoid a internal failure on START GROUP_REPLICATION that would |
| 36 |
# fail while reseting this channel leading to a unclean channel state. |
| 37 |
--error 0, ER_REPLICA_CHANNEL_DOES_NOT_EXIST |
| 38 |
RESET REPLICA FOR CHANNEL "group_replication_applier"; |
| 39 |
|
| 40 |
# Suppression of error messages |
| 41 |
SET sql_log_bin=0; |
| 42 |
CALL mtr.add_suppression("Error writing file.*(errno: 28 - No space left on device)"); |
| 43 |
CALL mtr.add_suppression("Disk is full writing.*(OS errno 28 - No space left on device)"); |
| 44 |
CALL mtr.add_suppression("Retry in 60 secs. Message reprinted in 600 secs"); |
| 45 |
CALL mtr.add_suppression("Unblocking the group replication thread waiting for applier to start, as the start group replication was killed"); |
| 46 |
CALL mtr.add_suppression("Unable to initialize the Group Replication applier module."); |
| 47 |
CALL mtr.add_suppression("MYSQL_BIN_LOG::open failed to sync the index file."); |
| 48 |
CALL mtr.add_suppression("Failed in open_log.*called from Relay_log_info::rli_init_info"); |
| 49 |
CALL mtr.add_suppression("Failed to setup the group replication applier thread."); |
| 50 |
call mtr.add_suppression("The group replication applier thread has received KILL request."); |
| 51 |
CALL mtr.add_suppression("Fatal error during execution on the Applier process of Group Replication. The server will now leave the group."); |
| 52 |
CALL mtr.add_suppression("Unable to confirm whether the server has left the group or not. Check performance_schema.replication_group_members to check group membership information."); |
| 53 |
CALL mtr.add_suppression("The server was automatically set into read only mode after an error was detected."); |
| 54 |
SET sql_log_bin=1; |
| 55 |
|
| 56 |
--replace_result $group_replication_group_name GROUP_REPLICATION_GROUP_NAME |
| 57 |
--eval SET GLOBAL group_replication_group_name= "$group_replication_group_name" |
| 58 |
SET GLOBAL group_replication_bootstrap_group=ON; |
| 59 |
|
| 60 |
--let $conn_id=`SELECT CONNECTION_ID()` |
| 61 |
|
| 62 |
--echo |
| 63 |
--echo # 2. Block START GR with no disk space. |
| 64 |
--echo |
| 65 |
SET @debug_save= @@GLOBAL.DEBUG; |
| 66 |
SET @@GLOBAL.DEBUG= 'd,simulate_file_write_error'; |
| 67 |
|
| 68 |
--send START GROUP_REPLICATION |
| 69 |
|
| 70 |
|
| 71 |
--echo |
| 72 |
--echo # 3. Verify START GR is blocked. |
| 73 |
--echo |
| 74 |
--let $rpl_connection_name= server_1 |
| 75 |
--source include/rpl_connection.inc |
| 76 |
|
| 77 |
--let $wait_condition= SELECT COUNT(*)=1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE='starting' AND INFO='start group_replication'; |
| 78 |
--source include/wait_condition.inc |
| 79 |
|
| 80 |
--let $wait_condition= SELECT COUNT(*)=1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE='Waiting for disk space'; |
| 81 |
--source include/wait_condition.inc |
| 82 |
|
| 83 |
|
| 84 |
--echo |
| 85 |
--echo # 4. Kill the blocked START GR command. |
| 86 |
--echo |
| 87 |
--replace_result $conn_id CONNECTION_ID |
| 88 |
--eval KILL QUERY $conn_id |
| 89 |
|
| 90 |
|
| 91 |
--echo |
| 92 |
--echo # 5. Reap the killed command and reset debug point. |
| 93 |
--echo |
| 94 |
--let $rpl_connection_name= server1 |
| 95 |
--source include/rpl_connection.inc |
| 96 |
--error ER_GROUP_REPLICATION_APPLIER_INIT_ERROR |
| 97 |
--reap |
| 98 |
|
| 99 |
|
| 100 |
SET @@GLOBAL.DEBUG= @debug_save; |
| 101 |
|
| 102 |
|
| 103 |
--echo |
| 104 |
--echo # 6. Verify member is still OFFLINE |
| 105 |
--echo |
| 106 |
--let $group_replication_member_state= OFFLINE |
| 107 |
--source include/gr_wait_for_member_state.inc |
| 108 |
|
| 109 |
|
| 110 |
--echo |
| 111 |
--echo # 7. Verify no more thread is waiting for disk space |
| 112 |
--echo |
| 113 |
--let $wait_condition= SELECT COUNT(*)=0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE='Waiting for disk space'; |
| 114 |
--source include/wait_condition.inc |
| 115 |
|
| 116 |
|
| 117 |
--echo |
| 118 |
--echo # 8. Restart group_replication on server1 and server2. |
| 119 |
--echo |
| 120 |
|
| 121 |
--source include/start_and_bootstrap_group_replication.inc |
| 122 |
|
| 123 |
--let $rpl_connection_name= server2 |
| 124 |
--source include/rpl_connection.inc |
| 125 |
--source include/start_group_replication.inc |
| 126 |
|
| 127 |
|
| 128 |
--echo |
| 129 |
--echo # 9. Add some data to server1. |
| 130 |
--echo |
| 131 |
|
| 132 |
--let $rpl_connection_name= server1 |
| 133 |
--source include/rpl_connection.inc |
| 134 |
|
| 135 |
CREATE TABLE test.t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB; |
| 136 |
INSERT INTO test.t1 VALUES (1); |
| 137 |
|
| 138 |
|
| 139 |
--echo |
| 140 |
--echo # 10. Verify data is replicated to the group. |
| 141 |
--echo |
| 142 |
|
| 143 |
# Wait for all servers to be in sync |
| 144 |
--source include/rpl_sync.inc |
| 145 |
|
| 146 |
--let $rpl_connection_name= server1 |
| 147 |
--source include/rpl_connection.inc |
| 148 |
|
| 149 |
--let $assert_text= Verify test.t1 is synced |
| 150 |
--let $assert_cond= "[SELECT count(*) COUNT FROM test.t1, COUNT, 1]" = "1" |
| 151 |
--source include/assert.inc |
| 152 |
|
| 153 |
|
| 154 |
--let $rpl_connection_name= server2 |
| 155 |
--source include/rpl_connection.inc |
| 156 |
|
| 157 |
--let $assert_text= Verify test.t1 is synced |
| 158 |
--let $assert_cond= "[SELECT count(*) COUNT FROM test.t1, COUNT, 1]" = "1" |
| 159 |
--source include/assert.inc |
| 160 |
|
| 161 |
|
| 162 |
--echo |
| 163 |
--echo # 11. Clean up |
| 164 |
--echo |
| 165 |
|
| 166 |
DROP TABLE t1; |
| 167 |
|
| 168 |
--source include/group_replication_end.inc |