| 1 |
############################################################################### |
| 2 |
# |
| 3 |
# No members can join the group while a configuration change is occurring |
| 4 |
# This test also checks the coordinator ignores messages if the member is not |
| 5 |
# Online |
| 6 |
# |
| 7 |
# Test: |
| 8 |
# 0. The test need two servers in multi primary mode |
| 9 |
# 1. Activate debug point that will block the group action when changing |
| 10 |
# to single primary mode, before the action end. |
| 11 |
# 2. Execute action to change group to single primary mode |
| 12 |
# Wait for it to reach the final stage |
| 13 |
# 3. A new member can't start GR while an action is being executed. |
| 14 |
# We also block the member from leaving after the error |
| 15 |
# Wait for the member to be visible on server 1 |
| 16 |
# 4. Unlock the action on server 1 |
| 17 |
# 5. Allow server 2 to leave |
| 18 |
# Check an error was returned by the start process |
| 19 |
# 6. After action is executed we can add another member |
| 20 |
# 7. Cleanup |
| 21 |
# |
| 22 |
############################################################################### |
| 23 |
|
| 24 |
--source include/big_test.inc |
| 25 |
--source include/have_debug_sync.inc |
| 26 |
--source include/have_group_replication_plugin.inc |
| 27 |
--let $rpl_skip_group_replication_start= 1 |
| 28 |
--source include/group_replication.inc |
| 29 |
|
| 30 |
--source include/start_and_bootstrap_group_replication.inc |
| 31 |
|
| 32 |
--echo |
| 33 |
--echo # 1. Activate debug point that will block the group action when changing |
| 34 |
--echo # to single primary mode |
| 35 |
|
| 36 |
SET @@GLOBAL.DEBUG= '+d,group_replication_block_group_action_stop'; |
| 37 |
--let $server1_uuid= query_get_value(SELECT @@SERVER_UUID, @@SERVER_UUID, 1) |
| 38 |
|
| 39 |
--echo |
| 40 |
--echo # 2. Execute action to change group to single primary mode |
| 41 |
|
| 42 |
--replace_result $server1_uuid MEMBER1_UUID |
| 43 |
--send_eval SELECT group_replication_switch_to_single_primary_mode("$server1_uuid") |
| 44 |
|
| 45 |
--let $rpl_connection_name= server_1 |
| 46 |
--source include/rpl_connection.inc |
| 47 |
|
| 48 |
--let $wait_condition=SELECT COUNT(*)=1 FROM performance_schema.events_stages_current WHERE event_name LIKE "%Single-primary Switch: waiting for%" |
| 49 |
--source include/wait_condition.inc |
| 50 |
|
| 51 |
--echo |
| 52 |
--echo # 3. A new member can't start GR while an action is being executed. |
| 53 |
--echo # We also block the member from leaving after the error |
| 54 |
--echo # Wait for the member to be visible on server 1 |
| 55 |
--let $rpl_connection_name= server2 |
| 56 |
--source include/rpl_connection.inc |
| 57 |
|
| 58 |
--replace_result $group_replication_group_name GROUP_NAME |
| 59 |
--eval SET GLOBAL group_replication_group_name= '$group_replication_group_name' |
| 60 |
|
| 61 |
# Add a wait on failure here to check coordination messages are ignored. |
| 62 |
SET @@GLOBAL.DEBUG= '+d,group_replication_wait_before_leave_on_error'; |
| 63 |
|
| 64 |
# Configure the member to use single-primary mode as server 1 is already configured |
| 65 |
SET GLOBAL group_replication_enforce_update_everywhere_checks= FALSE; |
| 66 |
SET GLOBAL group_replication_single_primary_mode= TRUE; |
| 67 |
--send START GROUP_REPLICATION |
| 68 |
|
| 69 |
--let $rpl_connection_name= server_1 |
| 70 |
--source include/rpl_connection.inc |
| 71 |
|
| 72 |
# Wait for 2 members to appear in the group |
| 73 |
--let $group_replication_number_of_members= 2 |
| 74 |
--source include/gr_wait_for_number_of_members.inc |
| 75 |
|
| 76 |
--echo |
| 77 |
--echo # 4. Unlock the action on server 1 |
| 78 |
|
| 79 |
--let $rpl_connection_name= server_1 |
| 80 |
--source include/rpl_connection.inc |
| 81 |
|
| 82 |
SET DEBUG_SYNC= "now SIGNAL signal.action_stop_continue"; |
| 83 |
|
| 84 |
--let $rpl_connection_name= server1 |
| 85 |
--source include/rpl_connection.inc |
| 86 |
|
| 87 |
--replace_result $server1_uuid MEMBER1_UUID |
| 88 |
--reap |
| 89 |
|
| 90 |
# 2 members still are visible in the group |
| 91 |
--let $group_replication_number_of_members= 2 |
| 92 |
--source include/gr_wait_for_number_of_members.inc |
| 93 |
|
| 94 |
--echo |
| 95 |
--echo # 5. Allow server 2 to leave |
| 96 |
--echo # Check an error was returned by the start process |
| 97 |
|
| 98 |
--let $rpl_connection_name= server_2 |
| 99 |
--source include/rpl_connection.inc |
| 100 |
|
| 101 |
SET DEBUG_SYNC= "now SIGNAL signal.continue_leave_process"; |
| 102 |
|
| 103 |
--let $rpl_connection_name= server2 |
| 104 |
--source include/rpl_connection.inc |
| 105 |
|
| 106 |
--error ER_GROUP_REPLICATION_CONFIGURATION |
| 107 |
--reap |
| 108 |
|
| 109 |
--let $rpl_connection_name= server_1 |
| 110 |
--source include/rpl_connection.inc |
| 111 |
|
| 112 |
# Confirm that only one member is present on the group |
| 113 |
--let $group_replication_number_of_members= 1 |
| 114 |
--source include/gr_wait_for_number_of_members.inc |
| 115 |
|
| 116 |
--let $wait_condition= SELECT COUNT(*)>=1 FROM performance_schema.error_log WHERE error_code='MY-013208' AND data LIKE "%A member is joining the group while a group configuration operation 'Change to single primary mode' is running initiated by 'SELECT group_replication_switch_to_single_primary_mode()'. The member will now leave the group.%" |
| 117 |
--source include/wait_condition.inc |
| 118 |
|
| 119 |
--echo |
| 120 |
--echo # 6. After action is executed we can add another member |
| 121 |
|
| 122 |
--let $rpl_connection_name= server2 |
| 123 |
--source include/rpl_connection.inc |
| 124 |
|
| 125 |
set session sql_log_bin=0; |
| 126 |
call mtr.add_suppression("A member cannot join the group while a group configuration operation 'Change to single primary mode' is running initiated by *"); |
| 127 |
set session sql_log_bin=1; |
| 128 |
|
| 129 |
--source include/start_group_replication.inc |
| 130 |
|
| 131 |
--echo |
| 132 |
--echo # 7. Cleanup |
| 133 |
|
| 134 |
--let $rpl_connection_name= server1 |
| 135 |
--source include/rpl_connection.inc |
| 136 |
|
| 137 |
SET @@GLOBAL.DEBUG= '-d,group_replication_block_group_action_stop'; |
| 138 |
|
| 139 |
set session sql_log_bin=0; |
| 140 |
call mtr.add_suppression("A member is joining the group while a group configuration operation 'Change to single primary mode' is running*"); |
| 141 |
set session sql_log_bin=1; |
| 142 |
|
| 143 |
--let $rpl_connection_name= server2 |
| 144 |
--source include/rpl_connection.inc |
| 145 |
|
| 146 |
SET @@GLOBAL.DEBUG= '-d,group_replication_wait_before_leave_on_error'; |
| 147 |
|
| 148 |
--let $rpl_group_replication_single_primary_mode=1 |
| 149 |
--let $rpl_group_replication_reset_persistent_vars=1 |
| 150 |
--source include/group_replication_end.inc |