| 1 |
############################################################################### |
| 2 |
# |
| 3 |
# When the plugin is stopped or leaves in error, while changing |
| 4 |
# from single primary mode to multi primary mode, if the member did |
| 5 |
# already set the single primary mode flag to false, then update |
| 6 |
# everywhere checks shall be true afer stop. |
| 7 |
# |
| 8 |
# When the plugin is stopped or leaves in error, plugin configurations |
| 9 |
# when the configuration change terminates must be valid, |
| 10 |
# even if not persisted with SET PERSIST. |
| 11 |
# |
| 12 |
# Test: |
| 13 |
# 0. This test requires three servers |
| 14 |
# 1. Server1 start and bootstrap the group |
| 15 |
# 2. Start server2 |
| 16 |
# 3. Start server3 and fake a stopped applier |
| 17 |
# 4. Execute action to switch to multi primary |
| 18 |
# 5. Server3 will leave group |
| 19 |
# 6. Server3 changed to ERROR state |
| 20 |
# 7. Check that Single primary mode is false on the stuck member and the |
| 21 |
# update everywhere checks are true |
| 22 |
# 8. Reap action executed |
| 23 |
# 9. Cleanup |
| 24 |
# |
| 25 |
############################################################################### |
| 26 |
|
| 27 |
--source include/big_test.inc |
| 28 |
--source include/have_debug.inc |
| 29 |
--source include/have_group_replication_plugin.inc |
| 30 |
--let $rpl_server_count= 3 |
| 31 |
--let $rpl_skip_group_replication_start= 1 |
| 32 |
--let $rpl_group_replication_single_primary_mode=1 |
| 33 |
--source include/group_replication.inc |
| 34 |
|
| 35 |
--echo |
| 36 |
--echo # 1. Server1 start and bootstrap the group |
| 37 |
|
| 38 |
--source include/start_and_bootstrap_group_replication.inc |
| 39 |
|
| 40 |
--echo |
| 41 |
--echo # 2. Start server2 |
| 42 |
|
| 43 |
--let $rpl_connection_name= server2 |
| 44 |
--source include/rpl_connection.inc |
| 45 |
--source include/start_group_replication.inc |
| 46 |
|
| 47 |
--echo |
| 48 |
--echo # 3. Start server3 and fake a stopped applier |
| 49 |
|
| 50 |
--let $rpl_connection_name= server3 |
| 51 |
--source include/rpl_connection.inc |
| 52 |
|
| 53 |
set session sql_log_bin=0; |
| 54 |
call mtr.add_suppression("A configuration change was killed in this member. The member will now leave the group as its configuration may have diverged."); |
| 55 |
call mtr.add_suppression("The server was automatically set into read only mode after an error was detected."); |
| 56 |
call mtr.add_suppression("Error while executing a group configuration operation: This operation ended in error as it was not possible to wait for the execution of the plugin queued transactions. The member will now leave the group."); |
| 57 |
call mtr.add_suppression("Skipping leave operation: concurrent attempt to leave the group is on-going."); |
| 58 |
set session sql_log_bin=1; |
| 59 |
|
| 60 |
--source include/start_group_replication.inc |
| 61 |
|
| 62 |
SET @@GLOBAL.DEBUG= '+d,group_replication_wait_for_gtid_execution_force_error'; |
| 63 |
|
| 64 |
--echo |
| 65 |
--echo # 4. Execute action to switch to multi primary |
| 66 |
|
| 67 |
--let $rpl_connection_name= server1 |
| 68 |
--source include/rpl_connection.inc |
| 69 |
|
| 70 |
--send SELECT group_replication_switch_to_multi_primary_mode() |
| 71 |
|
| 72 |
--echo |
| 73 |
--echo # 5. Server3 will leave group |
| 74 |
|
| 75 |
--let $rpl_connection_name= server2 |
| 76 |
--source include/rpl_connection.inc |
| 77 |
|
| 78 |
--let $group_replication_number_of_members= 2 |
| 79 |
--source include/gr_wait_for_number_of_members.inc |
| 80 |
|
| 81 |
--echo |
| 82 |
--echo # 6. Server3 changed to ERROR state |
| 83 |
|
| 84 |
--let $rpl_connection_name= server3 |
| 85 |
--source include/rpl_connection.inc |
| 86 |
|
| 87 |
--let $group_replication_member_state= ERROR |
| 88 |
--source include/gr_wait_for_member_state.inc |
| 89 |
|
| 90 |
SET @@GLOBAL.DEBUG= '-d,group_replication_wait_for_gtid_execution_force_error'; |
| 91 |
|
| 92 |
--echo |
| 93 |
--echo # 7. Check that Single primary mode is false on the stuck member and the |
| 94 |
--echo # update everywhere checks are true |
| 95 |
|
| 96 |
--let $assert_text= group_replication_enforce_update_everywhere_checks is ON |
| 97 |
--let $assert_cond= "[SELECT @@GLOBAL.group_replication_enforce_update_everywhere_checks]" = "1" |
| 98 |
--source include/assert.inc |
| 99 |
|
| 100 |
--let $assert_text= The single primary mode should be 0 here. |
| 101 |
--let $assert_cond= "[SELECT @@GLOBAL.group_replication_single_primary_mode]" = 0; |
| 102 |
--source include/assert.inc |
| 103 |
|
| 104 |
--echo |
| 105 |
--echo # 8. Reap action executed |
| 106 |
|
| 107 |
--let $rpl_connection_name= server1 |
| 108 |
--source include/rpl_connection.inc |
| 109 |
|
| 110 |
--reap |
| 111 |
|
| 112 |
--echo |
| 113 |
--echo # 9. Cleanup |
| 114 |
|
| 115 |
--let $rpl_connection_name= server3 |
| 116 |
--source include/rpl_connection.inc |
| 117 |
|
| 118 |
--source include/stop_group_replication.inc |
| 119 |
|
| 120 |
--let $group_replication_member_state= OFFLINE |
| 121 |
--source include/gr_wait_for_member_state.inc |
| 122 |
|
| 123 |
--source include/start_group_replication.inc |
| 124 |
|
| 125 |
--let $rpl_group_replication_reset_persistent_vars=1 |
| 126 |
--let $rpl_group_replication_single_primary_mode=1 |
| 127 |
--source include/group_replication_end.inc |