| 1 |
############################################################################### |
| 2 |
# |
| 3 |
# All changes to the primary mode shall be recorded with SET PERSIST |
| 4 |
# meaning they will have effect even after a member restart. |
| 5 |
# |
| 6 |
# variables persisted: |
| 7 |
# group_replication_enforce_update_everywhere_checks |
| 8 |
# group_replication_single_primary_mode |
| 9 |
# |
| 10 |
# Test: |
| 11 |
# 0. This test requires two servers |
| 12 |
# 1. Change to single primary mode |
| 13 |
# 2. Check all variables |
| 14 |
# 3. Restart Group Replication on server 2. Check all |
| 15 |
# goes as planned. |
| 16 |
# 4. Restart server 1. Don't pass the Primary mode settings. Check |
| 17 |
# all goes as planned. |
| 18 |
# |
| 19 |
############################################################################### |
| 20 |
|
| 21 |
--source include/have_group_replication_plugin.inc |
| 22 |
--source include/group_replication.inc |
| 23 |
|
| 24 |
--echo |
| 25 |
--echo # 1. Change to single primary mode |
| 26 |
|
| 27 |
--let $server1_uuid= query_get_value(SELECT @@SERVER_UUID, @@SERVER_UUID, 1) |
| 28 |
|
| 29 |
--replace_result $server1_uuid MEMBER1_UUID |
| 30 |
--eval SELECT group_replication_switch_to_single_primary_mode("$server1_uuid") |
| 31 |
|
| 32 |
--echo |
| 33 |
--echo # 2. Check all variables |
| 34 |
|
| 35 |
--let $rpl_connection_name= server1 |
| 36 |
--source include/rpl_connection.inc |
| 37 |
|
| 38 |
--let $assert_text= group_replication_enforce_update_everywhere_checks is ON |
| 39 |
--let $assert_cond= "[SELECT @@GLOBAL.group_replication_enforce_update_everywhere_checks]" = 0 |
| 40 |
--source include/assert.inc |
| 41 |
|
| 42 |
--let $assert_text= The single primary mode should be 1 here. |
| 43 |
--let $assert_cond= "[SELECT @@GLOBAL.group_replication_single_primary_mode]" = 1; |
| 44 |
--source include/assert.inc |
| 45 |
|
| 46 |
--let $assert_text= The super_read_only mode should be 0 here. |
| 47 |
--let $assert_cond= "[SELECT @@GLOBAL.super_read_only]" = 0; |
| 48 |
--source include/assert.inc |
| 49 |
|
| 50 |
--let $rpl_connection_name= server2 |
| 51 |
--source include/rpl_connection.inc |
| 52 |
|
| 53 |
--let $assert_text= group_replication_enforce_update_everywhere_checks is ON |
| 54 |
--let $assert_cond= "[SELECT @@GLOBAL.group_replication_enforce_update_everywhere_checks]" = 0 |
| 55 |
--source include/assert.inc |
| 56 |
|
| 57 |
--let $assert_text= The single primary mode should be 1 here. |
| 58 |
--let $assert_cond= "[SELECT @@GLOBAL.group_replication_single_primary_mode]" = 1; |
| 59 |
--source include/assert.inc |
| 60 |
|
| 61 |
--let $assert_text= The super_read_only mode should be 1 here. |
| 62 |
--let $assert_cond= "[SELECT @@GLOBAL.super_read_only]" = 1; |
| 63 |
--source include/assert.inc |
| 64 |
|
| 65 |
--echo |
| 66 |
--echo # 3. Restart Group Replication on server 2. Check all |
| 67 |
--echo # goes as planned. |
| 68 |
|
| 69 |
--let $rpl_connection_name= server2 |
| 70 |
--source include/rpl_connection.inc |
| 71 |
|
| 72 |
--source include/stop_group_replication.inc |
| 73 |
--source include/start_group_replication.inc |
| 74 |
|
| 75 |
--let $assert_text= group_replication_enforce_update_everywhere_checks is ON |
| 76 |
--let $assert_cond= "[SELECT @@GLOBAL.group_replication_enforce_update_everywhere_checks]" = 0 |
| 77 |
--source include/assert.inc |
| 78 |
|
| 79 |
--let $assert_text= The single primary mode should be 1 here. |
| 80 |
--let $assert_cond= "[SELECT @@GLOBAL.group_replication_single_primary_mode]" = 1; |
| 81 |
--source include/assert.inc |
| 82 |
|
| 83 |
--let $assert_text= The super_read_only mode should be 1 here. |
| 84 |
--let $assert_cond= "[SELECT @@GLOBAL.super_read_only]" = 1; |
| 85 |
--source include/assert.inc |
| 86 |
|
| 87 |
--echo |
| 88 |
--echo # 4. Restart server 1. Don't pass the Primary mode settings. Check |
| 89 |
--echo # all goes as planned. |
| 90 |
|
| 91 |
--let $rpl_connection_name= server1 |
| 92 |
--source include/rpl_connection.inc |
| 93 |
|
| 94 |
--let $allow_rpl_inited=1 |
| 95 |
--let $_group_replication_local_address= `SELECT @@GLOBAL.group_replication_local_address` |
| 96 |
--let $_group_replication_group_seeds= `SELECT @@GLOBAL.group_replication_group_seeds` |
| 97 |
--let $restart_parameters=restart:--group_replication_local_address=$_group_replication_local_address --group_replication_group_seeds=$_group_replication_group_seeds --group-replication-group-name=$group_replication_group_name |
| 98 |
--replace_result $_group_replication_local_address GROUP_REPLICATION_LOCAL_ADDRESS $_group_replication_group_seeds GROUP_REPLICATION_GROUP_SEEDS $group_replication_group_name GROUP_REPLICATION_GROUP_NAME |
| 99 |
--source include/restart_mysqld.inc |
| 100 |
|
| 101 |
--let $rpl_server_number= 1 |
| 102 |
--source include/rpl_reconnect.inc |
| 103 |
|
| 104 |
--let $assert_text= group_replication_enforce_update_everywhere_checks is ON |
| 105 |
--let $assert_cond= "[SELECT @@GLOBAL.group_replication_enforce_update_everywhere_checks]" = 0 |
| 106 |
--source include/assert.inc |
| 107 |
|
| 108 |
--let $assert_text= The single primary mode should be 1 here. |
| 109 |
--let $assert_cond= "[SELECT @@GLOBAL.group_replication_single_primary_mode]" = 1; |
| 110 |
--source include/assert.inc |
| 111 |
|
| 112 |
--source include/start_group_replication.inc |
| 113 |
|
| 114 |
--let $assert_text= The super_read_only mode should be 1 here. |
| 115 |
--let $assert_cond= "[SELECT @@GLOBAL.super_read_only]" = 1; |
| 116 |
--source include/assert.inc |
| 117 |
|
| 118 |
--let $rpl_group_replication_single_primary_mode=1 |
| 119 |
--let $rpl_group_replication_reset_persistent_vars=1 |
| 120 |
--source include/group_replication_end.inc |