| 1 |
############################################################################### |
| 2 |
# |
| 3 |
# If the action thread is killed but the distributed execution |
| 4 |
# has already gone beyond a point where all servers agreed (cannot be |
| 5 |
# canceled) then the action will complete. |
| 6 |
# |
| 7 |
# Test: |
| 8 |
# 0. This test requires two servers |
| 9 |
# 1. Use the debug point "group_replication_block_group_action_stop" on server 1 |
| 10 |
# 2. Start a change to single primary mode on server 1 |
| 11 |
# 3. Wait for the stage to be: Primary Switch: waiting for operation to |
| 12 |
# complete on all members |
| 13 |
# 4. Kill the query |
| 14 |
# 5. Unblock the debug point with "signal.action_stop_continue" |
| 15 |
# 6. Check the action returns successfully. |
| 16 |
# 7. Cleanup |
| 17 |
# |
| 18 |
############################################################################### |
| 19 |
|
| 20 |
--source include/have_debug_sync.inc |
| 21 |
--source include/have_group_replication_plugin.inc |
| 22 |
--source include/group_replication.inc |
| 23 |
|
| 24 |
--echo |
| 25 |
--echo # 1. Use the debug point "group_replication_block_group_action_stop" on server 1 |
| 26 |
|
| 27 |
SET @@GLOBAL.DEBUG= '+d,group_replication_block_group_action_stop'; |
| 28 |
--let $server1_uuid= query_get_value(SELECT @@SERVER_UUID, @@SERVER_UUID, 1) |
| 29 |
|
| 30 |
--echo |
| 31 |
--echo # 2. Start a change to single primary mode on server 1 |
| 32 |
|
| 33 |
--let $conn_id=`SELECT CONNECTION_ID()` |
| 34 |
|
| 35 |
--replace_result $server1_uuid MEMBER1_UUID |
| 36 |
--send_eval SELECT group_replication_switch_to_single_primary_mode("$server1_uuid") |
| 37 |
|
| 38 |
--echo |
| 39 |
--echo # 3. Wait for the stage to be: Primary Switch: waiting for operation to |
| 40 |
--echo # complete on all members |
| 41 |
|
| 42 |
--let $rpl_connection_name= server2 |
| 43 |
--source include/rpl_connection.inc |
| 44 |
|
| 45 |
--let $wait_condition=SELECT COUNT(*)=1 FROM performance_schema.events_stages_current WHERE event_name LIKE "%Single-primary Switch: waiting for operation to complete on all members%" |
| 46 |
--source include/wait_condition.inc |
| 47 |
|
| 48 |
--echo |
| 49 |
--echo # 4. Kill the query |
| 50 |
|
| 51 |
--let $rpl_connection_name= server_1 |
| 52 |
--source include/rpl_connection.inc |
| 53 |
|
| 54 |
SET DEBUG_SYNC = "now WAIT_FOR signal.action_stopping"; |
| 55 |
|
| 56 |
--replace_result $conn_id CONNECTION_ID |
| 57 |
--eval KILL QUERY $conn_id |
| 58 |
|
| 59 |
--echo |
| 60 |
--echo # 5. Unblock the debug point with "signal.action_stop_continue" |
| 61 |
|
| 62 |
SET DEBUG_SYNC= "now SIGNAL signal.action_stop_continue"; |
| 63 |
|
| 64 |
--echo |
| 65 |
--echo # 6. Check the action returns successfully. |
| 66 |
|
| 67 |
--let $rpl_connection_name= server1 |
| 68 |
--source include/rpl_connection.inc |
| 69 |
|
| 70 |
--replace_result $server1_uuid MEMBER1_UUID |
| 71 |
--reap |
| 72 |
|
| 73 |
--source include/gr_assert_primary_member.inc |
| 74 |
|
| 75 |
--let $rpl_connection_name= server2 |
| 76 |
--source include/rpl_connection.inc |
| 77 |
|
| 78 |
--source include/gr_assert_secondary_member.inc |
| 79 |
|
| 80 |
--echo |
| 81 |
--echo # 7. Cleanup |
| 82 |
|
| 83 |
--let $rpl_connection_name= server1 |
| 84 |
--source include/rpl_connection.inc |
| 85 |
|
| 86 |
SET @@GLOBAL.DEBUG= '-d,group_replication_block_group_action_stop'; |
| 87 |
|
| 88 |
SET DEBUG_SYNC='RESET'; |
| 89 |
|
| 90 |
--let $rpl_group_replication_single_primary_mode=1 |
| 91 |
--let $rpl_group_replication_reset_persistent_vars=1 |
| 92 |
--source include/group_replication_end.inc |