| 1 |
############################################################################### |
| 2 |
# This test verifies that if the recovery endpoints contains multiple valid |
| 3 |
# entries it shall succeed on first endpoint |
| 4 |
# |
| 5 |
# Test: |
| 6 |
# 0. The test requires two servers |
| 7 |
# 1. Install clone plugin on server1. |
| 8 |
# 2. Configure recovery endpoints with two valid endpoints |
| 9 |
# 3. Bootstrap server1 and add some data |
| 10 |
# 4. Restart server 2 with a monitoring process (mysqld_safe) if needed |
| 11 |
# 5. Setup the server so group replication starts on boot |
| 12 |
# Install the Clone plugin |
| 13 |
# 6. Ensure clone is used on recovery |
| 14 |
# 7. On a empty server2 start group replication |
| 15 |
# Wait for it to restart and come back |
| 16 |
# 8. Cleanup |
| 17 |
# |
| 18 |
############################################################################### |
| 19 |
|
| 20 |
--source include/have_mysqld_monitoring_process.inc |
| 21 |
--source include/have_clone_plugin.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 |
set session sql_log_bin=0; |
| 27 |
call mtr.add_suppression("Failed to initialize TLS for channel: mysql_admin"); |
| 28 |
call mtr.add_suppression("Failed to set up SSL because of the following SSL library error"); |
| 29 |
set session sql_log_bin=1; |
| 30 |
|
| 31 |
--echo |
| 32 |
--echo # 1. Install clone plugin on server1. |
| 33 |
|
| 34 |
--let $rpl_connection_name= server1 |
| 35 |
--source include/rpl_connection.inc |
| 36 |
|
| 37 |
--let $server1_port= `SELECT @@GLOBAL.PORT` |
| 38 |
--let $server1_admin_port= `SELECT @@GLOBAL.ADMIN_PORT` |
| 39 |
|
| 40 |
--replace_result $CLONE_PLUGIN CLONE_PLUGIN |
| 41 |
--eval INSTALL PLUGIN clone SONAME '$CLONE_PLUGIN' |
| 42 |
|
| 43 |
--echo |
| 44 |
--echo # 2. Configure recovery endpoints with two valid endpoints |
| 45 |
|
| 46 |
--replace_result $server1_admin_port SERVER1_ADMIN_PORT $server1_port SERVER1_PORT |
| 47 |
--eval SET @@GLOBAL.group_replication_advertise_recovery_endpoints = "127.0.0.1:$server1_admin_port,127.0.0.1:$server1_port" |
| 48 |
|
| 49 |
--echo |
| 50 |
--echo # 3. Bootstrap server1 and add some data |
| 51 |
|
| 52 |
--source include/start_and_bootstrap_group_replication.inc |
| 53 |
|
| 54 |
CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB; |
| 55 |
INSERT INTO t1 VALUES (1); |
| 56 |
INSERT INTO t1 VALUES (2); |
| 57 |
|
| 58 |
--echo |
| 59 |
--echo # 4. Restart server 2 with a monitoring process (mysqld_safe) if needed |
| 60 |
|
| 61 |
--let $rpl_connection_name= server2 |
| 62 |
--source include/rpl_connection.inc |
| 63 |
|
| 64 |
--let $_group_replication_local_address= `SELECT @@GLOBAL.group_replication_local_address` |
| 65 |
--let $_group_replication_group_seeds= `SELECT @@GLOBAL.group_replication_group_seeds` |
| 66 |
--let $_group_replication_start_on_boot= `SELECT @@GLOBAL.group_replication_start_on_boot` |
| 67 |
--let $_group_replication_comm_stack= `SELECT @@GLOBAL.group_replication_communication_stack` |
| 68 |
|
| 69 |
--let $plugin_list= $GROUP_REPLICATION |
| 70 |
--source include/spawn_monitoring_process.inc |
| 71 |
|
| 72 |
--echo |
| 73 |
--echo # 5. Setup the server so group replication starts on boot |
| 74 |
--echo # Install the Clone plugin |
| 75 |
|
| 76 |
--disable_query_log |
| 77 |
--eval SET PERSIST group_replication_group_name= "$group_replication_group_name" |
| 78 |
--eval SET PERSIST group_replication_local_address= "$_group_replication_local_address" |
| 79 |
--eval SET PERSIST group_replication_group_seeds= "$_group_replication_group_seeds" |
| 80 |
--eval SET PERSIST group_replication_communication_stack= "$_group_replication_comm_stack" |
| 81 |
|
| 82 |
SET PERSIST group_replication_start_on_boot= ON; |
| 83 |
--enable_query_log |
| 84 |
|
| 85 |
--replace_result $CLONE_PLUGIN CLONE_PLUGIN |
| 86 |
--eval INSTALL PLUGIN clone SONAME '$CLONE_PLUGIN' |
| 87 |
|
| 88 |
--echo |
| 89 |
--echo # 6. Ensure clone is used on recovery |
| 90 |
|
| 91 |
--let $_group_replication_threshold_save= `SELECT @@GLOBAL.group_replication_clone_threshold` |
| 92 |
SET GLOBAL group_replication_clone_threshold= 1; |
| 93 |
|
| 94 |
--echo |
| 95 |
--echo # 7. On a empty server2 start group replication |
| 96 |
--echo # Wait for it to restart and come back |
| 97 |
|
| 98 |
START GROUP_REPLICATION; |
| 99 |
|
| 100 |
--source include/wait_until_disconnected.inc |
| 101 |
|
| 102 |
--let $rpl_server_number= 2 |
| 103 |
--source include/rpl_reconnect.inc |
| 104 |
|
| 105 |
--let $group_replication_member_state=ONLINE |
| 106 |
--source include/gr_wait_for_member_state.inc |
| 107 |
|
| 108 |
# See if the data has been properly cloned in server2 |
| 109 |
--let $diff_tables=server1:test.t1 ,server2:test.t1 |
| 110 |
--source include/diff_tables.inc |
| 111 |
|
| 112 |
--echo |
| 113 |
--echo # 8. Cleanup |
| 114 |
|
| 115 |
--eval SET GLOBAL group_replication_clone_threshold= $_group_replication_threshold_save |
| 116 |
|
| 117 |
RESET PERSIST IF EXISTS group_replication_group_name; |
| 118 |
RESET PERSIST IF EXISTS group_replication_local_address; |
| 119 |
RESET PERSIST IF EXISTS group_replication_group_seeds; |
| 120 |
RESET PERSIST IF EXISTS group_replication_start_on_boot; |
| 121 |
RESET PERSIST IF EXISTS group_replication_communication_stack; |
| 122 |
|
| 123 |
--replace_result $_group_replication_start_on_boot START_ON_BOOT_VALUE |
| 124 |
--eval SET GLOBAL group_replication_start_on_boot= $_group_replication_start_on_boot |
| 125 |
|
| 126 |
DROP TABLE t1; |
| 127 |
|
| 128 |
--source include/rpl_sync.inc |
| 129 |
|
| 130 |
set session sql_log_bin=0; |
| 131 |
call mtr.add_suppression("Due to the number of missing transactions being higher than the configured threshold of*"); |
| 132 |
call mtr.add_suppression("Clone removing all user data for provisioning: Started"); |
| 133 |
call mtr.add_suppression("Clone removing all user data for provisioning: Finished"); |
| 134 |
set session sql_log_bin=1; |
| 135 |
|
| 136 |
--source include/clean_monitoring_process.inc |
| 137 |
|
| 138 |
UNINSTALL PLUGIN clone; |
| 139 |
|
| 140 |
--let $rpl_connection_name= server1 |
| 141 |
--source include/rpl_connection.inc |
| 142 |
|
| 143 |
--eval SET @@GLOBAL.group_replication_advertise_recovery_endpoints= "DEFAULT" |
| 144 |
|
| 145 |
UNINSTALL PLUGIN clone; |
| 146 |
|
| 147 |
--source include/group_replication_end.inc |