| 1 |
############################################################################### |
| 2 |
# This test verifies that if the missing transactions on a joining members are |
| 3 |
# above threshold the server will use clone as its recovery strategy, but if |
| 4 |
# the joiner server cannot restart after clone it will error out and shutdown. |
| 5 |
# The joiner server will be OK after a manual server start. |
| 6 |
# |
| 7 |
# 0. The test requires two servers: M1 and M2. |
| 8 |
# 1. Install the clone plugin on server 1 |
| 9 |
# 2. Bootstrap server1 and add some data |
| 10 |
# 3. Setup server2 so group replication starts on boot |
| 11 |
# 4. Start group replication on server 2 |
| 12 |
# Clone will fail to restart the server, as no monitoring |
| 13 |
# process is present which will cause a server shutdown. |
| 14 |
# 5. Start the server manually, clone will finish its work. |
| 15 |
# Verify also that the server failed to restart earlier |
| 16 |
# 6. Cleanup |
| 17 |
# |
| 18 |
|
| 19 |
--source include/not_windows.inc |
| 20 |
--source include/have_clone_plugin.inc |
| 21 |
--source include/force_restart.inc |
| 22 |
--source include/have_group_replication_plugin.inc |
| 23 |
--let $rpl_skip_group_replication_start= 1 |
| 24 |
--source include/group_replication.inc |
| 25 |
|
| 26 |
# Validate plugins |
| 27 |
--let plugins = CLONE_PLUGIN,GROUP_REPLICATION |
| 28 |
--source include/check_plugin_dir.inc |
| 29 |
|
| 30 |
|
| 31 |
--echo |
| 32 |
--echo ############################################################ |
| 33 |
--echo # 1. Install clone plugin on server1. |
| 34 |
|
| 35 |
--let $rpl_connection_name= server1 |
| 36 |
--source include/rpl_connection.inc |
| 37 |
|
| 38 |
--replace_result $CLONE_PLUGIN CLONE_PLUGIN |
| 39 |
--eval INSTALL PLUGIN clone SONAME '$CLONE_PLUGIN' |
| 40 |
|
| 41 |
--echo |
| 42 |
--echo ############################################################ |
| 43 |
--echo # 2. Bootstrap server1 and add some data |
| 44 |
|
| 45 |
--source include/start_and_bootstrap_group_replication.inc |
| 46 |
|
| 47 |
CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB; |
| 48 |
INSERT INTO t1 VALUES (1); |
| 49 |
INSERT INTO t1 VALUES (2); |
| 50 |
|
| 51 |
--echo |
| 52 |
--echo ############################################################ |
| 53 |
--echo # 3. Setup server2 so group replication starts on boot |
| 54 |
|
| 55 |
--let $rpl_connection_name= server2 |
| 56 |
--source include/rpl_connection.inc |
| 57 |
|
| 58 |
--let $_group_replication_local_address= `SELECT @@GLOBAL.group_replication_local_address` |
| 59 |
--let $_group_replication_group_seeds= `SELECT @@GLOBAL.group_replication_group_seeds` |
| 60 |
|
| 61 |
--disable_query_log |
| 62 |
--eval SET PERSIST group_replication_group_name= "$group_replication_group_name" |
| 63 |
--eval SET PERSIST group_replication_local_address= "$_group_replication_local_address" |
| 64 |
--eval SET PERSIST group_replication_group_seeds= "$_group_replication_group_seeds" |
| 65 |
|
| 66 |
SET PERSIST group_replication_start_on_boot= ON; |
| 67 |
--enable_query_log |
| 68 |
|
| 69 |
--replace_result $CLONE_PLUGIN CLONE_PLUGIN |
| 70 |
--eval INSTALL PLUGIN clone SONAME '$CLONE_PLUGIN' |
| 71 |
|
| 72 |
--echo |
| 73 |
--echo ################################################################ |
| 74 |
--echo # 4. Start group replication on server 2 |
| 75 |
--echo # Clone will fail to restart the server, as no monitoring |
| 76 |
--echo # process is present which will cause a server shutdown. |
| 77 |
--echo # |
| 78 |
|
| 79 |
--let $_group_replication_threshold_save= `SELECT @@GLOBAL.group_replication_clone_threshold` |
| 80 |
SET GLOBAL group_replication_clone_threshold= 1; |
| 81 |
|
| 82 |
START GROUP_REPLICATION; |
| 83 |
|
| 84 |
--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.2.expect |
| 85 |
--exec echo "wait" > $_expect_file_name |
| 86 |
--source include/wait_until_disconnected.inc |
| 87 |
|
| 88 |
--echo |
| 89 |
--echo ############################################################ |
| 90 |
--echo # 5. Start the server manually, clone will finish its work. |
| 91 |
--echo # Verify also that the server failed to restart earlier |
| 92 |
|
| 93 |
--source include/start_mysqld.inc |
| 94 |
|
| 95 |
--let $rpl_server_number= 2 |
| 96 |
--source include/rpl_reconnect.inc |
| 97 |
|
| 98 |
--let $group_replication_member_state=ONLINE |
| 99 |
--source include/gr_wait_for_member_state.inc |
| 100 |
|
| 101 |
--let $assert_text= Clone must be completed |
| 102 |
--let $assert_cond= [SELECT state="Completed" FROM performance_schema.clone_status] = 1; |
| 103 |
--source include/assert.inc |
| 104 |
|
| 105 |
# See if the data has been properly cloned in server2 |
| 106 |
--let $diff_tables=server1:test.t1 ,server2:test.t1 |
| 107 |
--source include/diff_tables.inc |
| 108 |
|
| 109 |
# Verify in the log file that the plugin failed to restart earlier |
| 110 |
--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.2.err |
| 111 |
--let $assert_text = Clone plugin failed to restart |
| 112 |
--let $assert_select = There was an issue when cloning from another server: Error number: 3707 Error message: Restart server failed |
| 113 |
--let $assert_count = 1 |
| 114 |
--source include/assert_grep.inc |
| 115 |
|
| 116 |
--echo |
| 117 |
--echo ############################################################ |
| 118 |
--echo # 6. Cleanup |
| 119 |
|
| 120 |
--eval SET GLOBAL group_replication_clone_threshold= $_group_replication_threshold_save; |
| 121 |
|
| 122 |
RESET PERSIST IF EXISTS group_replication_group_name; |
| 123 |
RESET PERSIST IF EXISTS group_replication_local_address; |
| 124 |
RESET PERSIST IF EXISTS group_replication_group_seeds; |
| 125 |
RESET PERSIST IF EXISTS group_replication_start_on_boot; |
| 126 |
|
| 127 |
DROP TABLE t1; |
| 128 |
|
| 129 |
--source include/rpl_sync.inc |
| 130 |
|
| 131 |
set session sql_log_bin=0; |
| 132 |
call mtr.add_suppression("This member will start distributed recovery using clone. It is due to the number of missing transactions being higher than the configured threshold of*"); |
| 133 |
call mtr.add_suppression("Internal query: CLONE INSTANCE FROM \'root\'@\'127.0.0.1\':[0-9]+ IDENTIFIED BY \'\\*\\*\\*\\*\\*\' REQUIRE NO SSL; result in error. Error number:*"); |
| 134 |
call mtr.add_suppression("There was an issue when cloning from another server: Error number: 3707 Error message: Restart server failed \\(mysqld is not managed by supervisor process\\)."); |
| 135 |
call mtr.add_suppression("Failed to establish an internal server connection to execute plugin operations. Server error: 3169. Server error message: Session was killed"); |
| 136 |
call mtr.add_suppression("Error running internal SQL query: SET GLOBAL super_read_only= 1;. Internal failure."); |
| 137 |
call mtr.add_suppression("The plugin encountered a critical error and will abort: Cannot re-enable the super read only after clone failure."); |
| 138 |
call mtr.add_suppression("Skipping leave operation: concurrent attempt to leave the group is on-going."); |
| 139 |
call mtr.add_suppression("Due to a critical cloning error or lack of donors, distributed recovery cannot be executed. The member will now leave the group."); |
| 140 |
call mtr.add_suppression("Clone removing all user data for provisioning: Started"); |
| 141 |
call mtr.add_suppression("Clone removing all user data for provisioning: Finished"); |
| 142 |
call mtr.add_suppression("Clone shutting down server as RESTART failed. Please start server to complete clone operation."); |
| 143 |
set session sql_log_bin=1; |
| 144 |
|
| 145 |
--source include/group_replication_end.inc |