| 1 |
################################################################################ |
| 2 |
# Verify that a member can properly handle view changes, and the consequent SQL |
| 3 |
# service calls, during server shutdown. |
| 4 |
# |
| 5 |
# Test: |
| 6 |
# 0) The test requires five servers: M1, M2, M3, M4 and M5. |
| 7 |
# 1. Create a group with 5 members. |
| 8 |
# 2. Crash member 5. |
| 9 |
# 3. Restart member 4. |
| 10 |
# 4. Validate that member is back ONLINE and group has 4 |
| 11 |
# members. |
| 12 |
# 5. Wait for client reconnection to server 5. |
| 13 |
# 6. Clean up. |
| 14 |
################################################################################ |
| 15 |
# This test does crash servers, thence we skip it on valgrind. |
| 16 |
--source include/not_valgrind.inc |
| 17 |
--source include/big_test.inc |
| 18 |
--source include/force_restart.inc |
| 19 |
--source include/have_group_replication_plugin.inc |
| 20 |
|
| 21 |
|
| 22 |
--echo |
| 23 |
--echo ############################################################ |
| 24 |
--echo # 1. Create a group with 5 members. |
| 25 |
--let $rpl_server_count= 5 |
| 26 |
--source include/group_replication.inc |
| 27 |
|
| 28 |
# Ensure that member 4 was already notified that all 5 members are |
| 29 |
# online. |
| 30 |
--let $rpl_connection_name= server4 |
| 31 |
--source include/rpl_connection.inc |
| 32 |
--let $wait_condition=SELECT COUNT(*)=5 FROM performance_schema.replication_group_members where MEMBER_STATE="ONLINE" |
| 33 |
--source include/wait_condition.inc |
| 34 |
|
| 35 |
--echo |
| 36 |
--echo ############################################################ |
| 37 |
--echo # 2. Crash member 5. |
| 38 |
# We do kill the server, using shutdown_server 0, and then MTR will |
| 39 |
# follow the expect file and restart the server, but we do not wait |
| 40 |
# for the server restart. |
| 41 |
# Since the server loose its GCS configuration it will not rejoin |
| 42 |
# the group. |
| 43 |
--let $rpl_connection_name= server5 |
| 44 |
--source include/rpl_connection.inc |
| 45 |
|
| 46 |
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.5.expect |
| 47 |
--shutdown_server 0 |
| 48 |
--source include/wait_until_disconnected.inc |
| 49 |
|
| 50 |
|
| 51 |
--echo |
| 52 |
--echo ############################################################ |
| 53 |
--echo # 3. Restart member 4. |
| 54 |
--echo # Member 4 will receive the view on which member 5 is |
| 55 |
--echo # expelled during server shutdown, this was triggering |
| 56 |
--echo # assert failures on SQL service |
| 57 |
--echo # Srv_session::deinit_thread(). |
| 58 |
--let $rpl_connection_name= server4 |
| 59 |
--source include/rpl_connection.inc |
| 60 |
|
| 61 |
--let $allow_rpl_inited= 1 |
| 62 |
--let $_group_replication_local_address= `SELECT @@GLOBAL.group_replication_local_address` |
| 63 |
--let $_group_replication_group_seeds= `SELECT @@GLOBAL.group_replication_group_seeds` |
| 64 |
--let $restart_parameters=restart:--group_replication_group_name=$group_replication_group_name --group_replication_local_address=$_group_replication_local_address --group_replication_group_seeds=$_group_replication_group_seeds --group_replication_bootstrap_group=0 --group_replication_start_on_boot=1 |
| 65 |
--replace_result $group_replication_group_name GROUP_REPLICATION_GROUP_NAME $_group_replication_local_address GROUP_REPLICATION_LOCAL_ADDRESS $_group_replication_group_seeds GROUP_REPLICATION_GROUP_SEEDS |
| 66 |
--source include/restart_mysqld.inc |
| 67 |
|
| 68 |
# Wait for client reconnection. |
| 69 |
--let $rpl_server_number= 4 |
| 70 |
--source include/rpl_reconnect.inc |
| 71 |
|
| 72 |
|
| 73 |
--echo |
| 74 |
--echo ############################################################ |
| 75 |
--echo # 4. Validate that member is back ONLINE and group has 4 |
| 76 |
--echo # members. |
| 77 |
--let $group_replication_member_state= ONLINE |
| 78 |
--source include/gr_wait_for_member_state.inc |
| 79 |
|
| 80 |
--let $wait_condition=SELECT COUNT(*)=4 FROM performance_schema.replication_group_members where MEMBER_STATE="ONLINE" |
| 81 |
--source include/wait_condition.inc |
| 82 |
|
| 83 |
# Expected errors since SQL service will not be able to establish |
| 84 |
# a session on server, since it is shutting down. |
| 85 |
SET SESSION sql_log_bin= 0; |
| 86 |
call mtr.add_suppression("Plugin group_replication reported: 'Error, maximum number of retries exceeded when waiting for the internal server session state to be operating'"); |
| 87 |
call mtr.add_suppression("Plugin group_replication reported: 'Failed to establish an internal server connection to execute plugin operations'"); |
| 88 |
call mtr.add_suppression("Plugin group_replication reported: 'Error when extracting information for group change. Operations and checks made to group joiners may be incomplete.'"); |
| 89 |
call mtr.add_suppression("Replica SQL for channel 'group_replication_applier': ... The replica coordinator and worker threads are stopped.*"); |
| 90 |
call mtr.add_suppression("Plugin group_replication reported: 'The applier thread execution was aborted. Unable to process more transactions, this member will now leave the group.'"); |
| 91 |
call mtr.add_suppression("Plugin group_replication reported: 'Fatal error during execution on the Applier process of Group Replication. The server will now leave the group.'"); |
| 92 |
call mtr.add_suppression("Plugin group_replication reported: 'The server was automatically set into read only mode after an error was detected.'"); |
| 93 |
call mtr.add_suppression("Plugin group_replication reported: 'Skipping leave operation: concurrent attempt to leave the group is on-going.'"); |
| 94 |
call mtr.add_suppression("Error writing relay log configuration."); |
| 95 |
call mtr.add_suppression("Plugin group_replication reported: 'Failed to stop the group replication applier thread."); |
| 96 |
SET SESSION sql_log_bin= 1; |
| 97 |
|
| 98 |
|
| 99 |
--echo |
| 100 |
--echo ############################################################ |
| 101 |
--echo # 5. Wait for client reconnection to server 5. |
| 102 |
--let $rpl_connection_name= server_5 |
| 103 |
--source include/rpl_connection.inc |
| 104 |
--let $rpl_server_number= 5 |
| 105 |
--source include/rpl_reconnect.inc |
| 106 |
|
| 107 |
|
| 108 |
--echo |
| 109 |
--echo ############################################################ |
| 110 |
--echo # 6. Clean up. |
| 111 |
--source include/group_replication_end.inc |