| 1 |
############################################################################### |
| 2 |
# |
| 3 |
# Any failure to enable the read mode in the server for data protection |
| 4 |
# shall result in a server abort. |
| 5 |
# |
| 6 |
# Test: |
| 7 |
# 0. A group of 3 members in multi primary mode. |
| 8 |
# 1. Set server 1 to fail when setting the read mode |
| 9 |
# 2. Execute a change to single primary mode with server 2 as the primary |
| 10 |
# 3. Wait for server 1 to crash and restart it. |
| 11 |
# Check other members see it leave |
| 12 |
# 4. Check the error message is in the log |
| 13 |
# 5. Cleanup |
| 14 |
# |
| 15 |
############################################################################### |
| 16 |
|
| 17 |
--source include/have_debug.inc |
| 18 |
--source include/not_valgrind.inc |
| 19 |
--source include/have_group_replication_plugin.inc |
| 20 |
--let $rpl_server_count= 3 |
| 21 |
--source include/group_replication.inc |
| 22 |
|
| 23 |
--echo |
| 24 |
--echo # 1. Set server 1 to fail when setting the read |
| 25 |
|
| 26 |
#This is cleaned on restart |
| 27 |
SET @@GLOBAL.DEBUG= '+d,group_replication_read_mode_error'; |
| 28 |
|
| 29 |
# Prepare server 1 for impending abort() |
| 30 |
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
| 31 |
|
| 32 |
--echo |
| 33 |
--echo # 2. Execute a change to single primary mode with server 2 as the primary |
| 34 |
|
| 35 |
--let $rpl_connection_name= server2 |
| 36 |
--source include/rpl_connection.inc |
| 37 |
|
| 38 |
--let $server2_uuid= query_get_value(SELECT @@SERVER_UUID, @@SERVER_UUID, 1) |
| 39 |
|
| 40 |
--replace_result $server2_uuid MEMBER2_UUID |
| 41 |
--send_eval SELECT group_replication_switch_to_single_primary_mode("$server2_uuid") |
| 42 |
|
| 43 |
--echo |
| 44 |
--echo # 3. Wait for server 1 to crash and restart it |
| 45 |
--echo # Check other members see it leave |
| 46 |
|
| 47 |
--let $rpl_connection_name= server1 |
| 48 |
--source include/rpl_connection.inc |
| 49 |
|
| 50 |
--source include/wait_until_disconnected.inc |
| 51 |
|
| 52 |
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
| 53 |
--enable_reconnect |
| 54 |
--source include/wait_until_connected_again.inc |
| 55 |
|
| 56 |
--let $rpl_server_number= 1 |
| 57 |
--source include/rpl_reconnect.inc |
| 58 |
|
| 59 |
--let $rpl_connection_name= server_2 |
| 60 |
--source include/rpl_connection.inc |
| 61 |
|
| 62 |
--let $group_replication_number_of_members= 2 |
| 63 |
--source include/gr_wait_for_number_of_members.inc |
| 64 |
|
| 65 |
--let $rpl_connection_name= server2 |
| 66 |
--source include/rpl_connection.inc |
| 67 |
|
| 68 |
--replace_result $server2_uuid MEMBER2_UUID |
| 69 |
--reap |
| 70 |
|
| 71 |
--echo # 4. Check the error message is in the log |
| 72 |
|
| 73 |
--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err |
| 74 |
--let $assert_count = 1 |
| 75 |
--let $assert_select = Cannot enable the super read only mode on a secondary member. |
| 76 |
--let $assert_text = Found the expected error in server log |
| 77 |
--source include/assert_grep.inc |
| 78 |
|
| 79 |
--echo # 5. Cleanup |
| 80 |
|
| 81 |
--let $rpl_connection_name= server1 |
| 82 |
--source include/rpl_connection.inc |
| 83 |
|
| 84 |
set session sql_log_bin=0; |
| 85 |
call mtr.add_suppression("The plugin encountered a critical error and will abort: Cannot enable the super read only mode on a secondary member.*"); |
| 86 |
call mtr.add_suppression("Error, maximum number of retries exceeded when waiting for the internal server session state to be operating"); |
| 87 |
call mtr.add_suppression("Failed to establish an internal server connection to execute plugin operations"); |
| 88 |
call mtr.add_suppression("There was an issue on the primary election process.*"); |
| 89 |
call mtr.add_suppression("The server was automatically set into read only mode after an error was detected."); |
| 90 |
call mtr.add_suppression("Skipping leave operation: concurrent attempt to leave the group is on-going."); |
| 91 |
call mtr.add_suppression("Error while executing a group configuration operation: This operation was locally aborted and for that reason terminated.*"); |
| 92 |
set session sql_log_bin=1; |
| 93 |
|
| 94 |
--let $rpl_group_replication_single_primary_mode=1 |
| 95 |
--let $rpl_group_replication_reset_persistent_vars=1 |
| 96 |
--source include/group_replication_end.inc |