| 1 |
################################################################################ |
| 2 |
# |
| 3 |
# exit_state_action sysvar specifies which action is taken by a server once it |
| 4 |
# has involuntarily left the group. Currently there are only two actions: |
| 5 |
# either the server continues running but with super_read_only enabled |
| 6 |
# (READ_ONLY) or it aborts (ABORT_SERVER). |
| 7 |
# |
| 8 |
# This test verifies that the sysvar behaves as expected, meaning that the |
| 9 |
# default value is the expected one (READ_ONLY), that we can change it |
| 10 |
# and the value is maintained and that invalid values result in error. |
| 11 |
# |
| 12 |
# Test: |
| 13 |
# 0) The test requires one server. |
| 14 |
# 1) Check the default value. It should be READ_ONLY. |
| 15 |
# 2) Set the sysvar to the possible valid values. Verify that the valid values |
| 16 |
# are accepted with no error and the values are set correctly. |
| 17 |
# 3) Set the sysvar to invalid values. There should be an error and the value of |
| 18 |
# the sysvar should not be altered. |
| 19 |
# 4) Cleanup. |
| 20 |
# |
| 21 |
################################################################################ |
| 22 |
--source include/have_debug.inc |
| 23 |
--source include/have_group_replication_plugin.inc |
| 24 |
--let $rpl_skip_group_replication_start= 1 |
| 25 |
--source include/group_replication.inc |
| 26 |
|
| 27 |
--echo |
| 28 |
--echo ######################################################################### |
| 29 |
--echo # 0) The test requires one server. |
| 30 |
--echo ######################################################################### |
| 31 |
--echo |
| 32 |
--let $rpl_connection_name= server1 |
| 33 |
--source include/rpl_connection.inc |
| 34 |
SET @exit_state_action_saved = @@GLOBAL.group_replication_exit_state_action; |
| 35 |
|
| 36 |
--echo |
| 37 |
--echo ######################################################################### |
| 38 |
--echo # 1) Check the default value. It should be READ_ONLY. |
| 39 |
--echo ######################################################################### |
| 40 |
--echo |
| 41 |
SET @@GLOBAL.group_replication_exit_state_action = default; |
| 42 |
--let $assert_text= The default of group_replication_exit_state_action should be READ_ONLY |
| 43 |
--let $assert_cond= "[SELECT @@GLOBAL.group_replication_exit_state_action]" = "READ_ONLY" |
| 44 |
--source include/assert.inc |
| 45 |
|
| 46 |
--echo |
| 47 |
--echo ######################################################################### |
| 48 |
--echo # 2) Set the sysvar to the possible valid values. |
| 49 |
--echo ######################################################################### |
| 50 |
--echo |
| 51 |
SET GLOBAL group_replication_exit_state_action = "OFFLINE_MODE"; |
| 52 |
--let $assert_text= The value of group_replication_exit_state_action should be OFFLINE_MODE |
| 53 |
--let $assert_cond= "[SELECT @@GLOBAL.group_replication_exit_state_action]" = "OFFLINE_MODE" |
| 54 |
--source include/assert.inc |
| 55 |
SET GLOBAL group_replication_exit_state_action = "ABORT_SERVER"; |
| 56 |
--let $assert_text= The value of group_replication_exit_state_action should be ABORT_SERVER |
| 57 |
--let $assert_cond= "[SELECT @@GLOBAL.group_replication_exit_state_action]" = "ABORT_SERVER" |
| 58 |
--source include/assert.inc |
| 59 |
SET GLOBAL group_replication_exit_state_action = "READ_ONLY"; |
| 60 |
--let $assert_text= The value of group_replication_exit_state_action should be READ_ONLY |
| 61 |
--let $assert_cond= "[SELECT @@GLOBAL.group_replication_exit_state_action]" = "READ_ONLY" |
| 62 |
--source include/assert.inc |
| 63 |
|
| 64 |
--echo |
| 65 |
--echo ######################################################################### |
| 66 |
--echo # 3) Set the sysvar to invalid values. There should be an error and the |
| 67 |
--echo # value of the sysvar should not be altered. |
| 68 |
--echo ######################################################################### |
| 69 |
--echo |
| 70 |
--error ER_WRONG_VALUE_FOR_VAR |
| 71 |
SET GLOBAL group_replication_exit_state_action = 42; |
| 72 |
--error ER_WRONG_VALUE_FOR_VAR |
| 73 |
SET GLOBAL group_replication_exit_state_action = on; |
| 74 |
--error ER_WRONG_VALUE_FOR_VAR |
| 75 |
SET GLOBAL group_replication_exit_state_action = "abort"; |
| 76 |
--let $assert_text= The value of group_replication_exit_state_action should be READ_ONLY |
| 77 |
--let $assert_cond= "[SELECT @@GLOBAL.group_replication_exit_state_action]" = "READ_ONLY" |
| 78 |
--source include/assert.inc |
| 79 |
|
| 80 |
--echo |
| 81 |
--echo ######################################################################### |
| 82 |
--echo # 4) Cleanup. |
| 83 |
--echo ######################################################################### |
| 84 |
--echo |
| 85 |
SET GLOBAL group_replication_exit_state_action = @exit_state_action_saved; |
| 86 |
--source include/group_replication_end.inc |