| 1 |
############################################################################### |
| 2 |
# |
| 3 |
# When a member has recovery blocked and is stopped, STOP GROUP_REPLICATION |
| 4 |
# will return with an warning and log an error about the not stopping the |
| 5 |
# threads. |
| 6 |
# |
| 7 |
# Test: |
| 8 |
# 0. This test requires two servers |
| 9 |
# 1. Bootstrap the group on server1 |
| 10 |
# 2. Set a lower components timeout and lock tables on server2. |
| 11 |
# Start group replication that will block when applying VCLE |
| 12 |
# 3. Wait recovery is on hold due lock on tables and Stop Group |
| 13 |
# Replication. |
| 14 |
# 4. Starting server2 will fail, recovery module fail to stop, as it is |
| 15 |
# blocked |
| 16 |
# 5. UNLOCK tables on server2 and recovery module shall stop. Now Group |
| 17 |
# Replication is able to start |
| 18 |
# 6. Assert that even stop command returns a warning is thrown as |
| 19 |
# recovery fails to stop |
| 20 |
# 7. Cleanup |
| 21 |
# |
| 22 |
############################################################################### |
| 23 |
|
| 24 |
--source include/big_test.inc |
| 25 |
--source include/not_have_privilege_checks_user.inc |
| 26 |
--source include/have_group_replication_plugin.inc |
| 27 |
--let $rpl_server_count= 2 |
| 28 |
--let $rpl_skip_group_replication_start= 1 |
| 29 |
--source include/group_replication.inc |
| 30 |
|
| 31 |
--echo |
| 32 |
--echo # 1. Bootstrap the group on server1 |
| 33 |
|
| 34 |
--source include/start_and_bootstrap_group_replication.inc |
| 35 |
|
| 36 |
--echo |
| 37 |
--echo # 2. Set a lower components timeout and lock tables on server2. |
| 38 |
--echo # Start group replication that will block when applying VCLE |
| 39 |
|
| 40 |
--let $rpl_connection_name= server2 |
| 41 |
--source include/rpl_connection.inc |
| 42 |
|
| 43 |
SET @group_replication_components_stop_timeout_save = @@GLOBAL.group_replication_components_stop_timeout; |
| 44 |
SET GLOBAL group_replication_components_stop_timeout = 30; |
| 45 |
|
| 46 |
--let $rpl_connection_name= server_2 |
| 47 |
--source include/rpl_connection.inc |
| 48 |
|
| 49 |
SET GLOBAL super_read_only= 1; |
| 50 |
FLUSH TABLES WITH READ LOCK; |
| 51 |
|
| 52 |
--let $rpl_connection_name= server2 |
| 53 |
--source include/rpl_connection.inc |
| 54 |
|
| 55 |
--let $group_replication_start_member_state= RECOVERING |
| 56 |
--source include/start_group_replication.inc |
| 57 |
|
| 58 |
--echo |
| 59 |
--echo # 3. Wait recovery is on hold due lock on tables and Stop Group |
| 60 |
--echo # Replication. |
| 61 |
|
| 62 |
--let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist WHERE user='system user' AND state='Waiting for commit lock' |
| 63 |
--source include/wait_condition.inc |
| 64 |
|
| 65 |
--source include/stop_group_replication.inc |
| 66 |
|
| 67 |
--echo |
| 68 |
--echo # 4. Starting server2 will fail, recovery module fail to stop, as it is |
| 69 |
--echo # blocked |
| 70 |
|
| 71 |
--error ER_GRP_RPL_RECOVERY_CHANNEL_STILL_RUNNING |
| 72 |
START GROUP_REPLICATION; |
| 73 |
|
| 74 |
--echo |
| 75 |
--echo # 5. UNLOCK tables on server2 and recovery module shall stop. Now Group |
| 76 |
--echo # Replication is able to start |
| 77 |
|
| 78 |
--let $rpl_connection_name= server_2 |
| 79 |
--source include/rpl_connection.inc |
| 80 |
UNLOCK TABLES; |
| 81 |
|
| 82 |
--source include/start_group_replication.inc |
| 83 |
|
| 84 |
--echo # 6. Assert that even stop command returns a warning is thrown as |
| 85 |
--echo # recovery fails to stop |
| 86 |
|
| 87 |
--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.2.err |
| 88 |
--let $assert_text = STOP GROUP REPLICATION return timeout on stopping recovery module |
| 89 |
--let $assert_select = \[Warning\] \[MY-011653\] \[Repl\] Plugin group_replication reported: 'On shutdown there was a timeout on the Group Replication recovery module termination. Check the log for more details' |
| 90 |
--let $assert_count = 1 |
| 91 |
--source include/assert_grep.inc |
| 92 |
|
| 93 |
|
| 94 |
--echo |
| 95 |
--echo # 7. Cleanup |
| 96 |
|
| 97 |
--let $rpl_connection_name= server2 |
| 98 |
--source include/rpl_connection.inc |
| 99 |
|
| 100 |
SET SESSION sql_log_bin= 0; |
| 101 |
call mtr.add_suppression("Error when stopping the group replication incremental recovery's donor connection"); |
| 102 |
call mtr.add_suppression('On shutdown there was a timeout on the Group Replication recovery module termination. Check the log for more details'); |
| 103 |
SET SESSION sql_log_bin= 1; |
| 104 |
|
| 105 |
SET @@GLOBAl.group_replication_components_stop_timeout = @group_replication_components_stop_timeout_save; |
| 106 |
|
| 107 |
--source include/group_replication_end.inc |