| 1 |
############################################################################### |
| 2 |
# This test verifies that clone can be used during member join when it is |
| 3 |
# configured with group_replication_consistency= AFTER. |
| 4 |
# |
| 5 |
# 0. The test requires two servers: M1 and M2. |
| 6 |
# 1. Install the clone plugin on server 1 |
| 7 |
# 2. Bootstrap server1 and add some data |
| 8 |
# 3. Configure globally and persist group_replication_consistency globally to AFTER. |
| 9 |
# Restart server 2 with a monitoring process (mysqld_safe) if needed |
| 10 |
# 4. Setup the server so group replication starts on boot |
| 11 |
# Install the Clone plugin |
| 12 |
# 5. On a empty server2 start group replication |
| 13 |
# Wait for it to restart and come back |
| 14 |
# Check clone was completed |
| 15 |
# 6. Cleanup |
| 16 |
# |
| 17 |
|
| 18 |
--source include/have_mysqld_monitoring_process.inc |
| 19 |
--source include/have_clone_plugin.inc |
| 20 |
--source include/have_group_replication_plugin.inc |
| 21 |
--let $rpl_skip_group_replication_start= 1 |
| 22 |
--source include/group_replication.inc |
| 23 |
|
| 24 |
# Validate plugins |
| 25 |
--let plugins = CLONE_PLUGIN,GROUP_REPLICATION |
| 26 |
--source include/check_plugin_dir.inc |
| 27 |
|
| 28 |
|
| 29 |
--echo |
| 30 |
--echo ############################################################ |
| 31 |
--echo # 1. Install clone plugin on server1. |
| 32 |
|
| 33 |
--let $rpl_connection_name= server1 |
| 34 |
--source include/rpl_connection.inc |
| 35 |
--let $server1_port= `SELECT @@GLOBAL.PORT` |
| 36 |
|
| 37 |
--replace_result $CLONE_PLUGIN CLONE_PLUGIN |
| 38 |
--eval INSTALL PLUGIN clone SONAME '$CLONE_PLUGIN' |
| 39 |
|
| 40 |
--echo |
| 41 |
--echo ############################################################ |
| 42 |
--echo # 2. Bootstrap server1 and add some data |
| 43 |
|
| 44 |
--source include/start_and_bootstrap_group_replication.inc |
| 45 |
|
| 46 |
CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB; |
| 47 |
INSERT INTO t1 VALUES (1); |
| 48 |
INSERT INTO t1 VALUES (2); |
| 49 |
|
| 50 |
--echo |
| 51 |
--echo ####################################################################### |
| 52 |
--echo # 3. Configure globally and persist group_replication_consistency globally to AFTER. |
| 53 |
--echo # Restart server 2 with a monitoring process (mysqld_safe) if needed |
| 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 |
--let $_group_replication_start_on_boot= `SELECT @@GLOBAL.group_replication_start_on_boot` |
| 61 |
--let $_group_replication_comm_stack= `SELECT @@GLOBAL.group_replication_communication_stack` |
| 62 |
|
| 63 |
--let $_group_replication_consistency_save= `SELECT @@GLOBAL.group_replication_consistency` |
| 64 |
SET PERSIST group_replication_consistency= AFTER; |
| 65 |
|
| 66 |
--let $plugin_list= $GROUP_REPLICATION |
| 67 |
--source include/spawn_monitoring_process.inc |
| 68 |
|
| 69 |
--echo |
| 70 |
--echo ############################################################ |
| 71 |
--echo # 4. Setup the server so group replication starts on boot |
| 72 |
--echo # Install the Clone plugin |
| 73 |
|
| 74 |
--disable_query_log |
| 75 |
--eval SET PERSIST group_replication_group_name= "$group_replication_group_name" |
| 76 |
--eval SET PERSIST group_replication_local_address= "$_group_replication_local_address" |
| 77 |
--eval SET PERSIST group_replication_group_seeds= "$_group_replication_group_seeds" |
| 78 |
--eval SET PERSIST group_replication_communication_stack= "$_group_replication_comm_stack" |
| 79 |
|
| 80 |
SET PERSIST group_replication_start_on_boot= ON; |
| 81 |
--enable_query_log |
| 82 |
|
| 83 |
--replace_result $CLONE_PLUGIN CLONE_PLUGIN |
| 84 |
--eval INSTALL PLUGIN clone SONAME '$CLONE_PLUGIN' |
| 85 |
|
| 86 |
--echo |
| 87 |
--echo ############################################################ |
| 88 |
--echo # 5. On a empty server2 start group replication |
| 89 |
--echo # Wait for it to restart and come back |
| 90 |
--echo # Check clone was completed |
| 91 |
|
| 92 |
--let $_group_replication_clone_threshold_save= `SELECT @@GLOBAL.group_replication_clone_threshold` |
| 93 |
SET GLOBAL group_replication_clone_threshold= 1; |
| 94 |
|
| 95 |
--let $assert_text= group_replication_consistency is AFTER |
| 96 |
--let $assert_cond= "[SELECT @@GLOBAL.group_replication_consistency]" = "AFTER" |
| 97 |
--source include/assert.inc |
| 98 |
|
| 99 |
START GROUP_REPLICATION; |
| 100 |
|
| 101 |
--source include/wait_until_disconnected.inc |
| 102 |
|
| 103 |
--let $rpl_server_number= 2 |
| 104 |
--source include/rpl_reconnect.inc |
| 105 |
|
| 106 |
--let $group_replication_member_state=ONLINE |
| 107 |
--source include/gr_wait_for_member_state.inc |
| 108 |
|
| 109 |
--let $assert_text= group_replication_consistency is AFTER |
| 110 |
--let $assert_cond= "[SELECT @@GLOBAL.group_replication_consistency]" = "AFTER" |
| 111 |
--source include/assert.inc |
| 112 |
|
| 113 |
--let $assert_text= Clone must be completed |
| 114 |
--let $assert_cond= [SELECT state="Completed" FROM performance_schema.clone_status] = 1; |
| 115 |
--source include/assert.inc |
| 116 |
|
| 117 |
# See if the data has been properly cloned in server2 |
| 118 |
--let $diff_tables=server1:test.t1 ,server2:test.t1 |
| 119 |
--source include/diff_tables.inc |
| 120 |
|
| 121 |
--echo |
| 122 |
--echo ############################################################ |
| 123 |
--echo # 6. Cleanup |
| 124 |
|
| 125 |
--let $rpl_connection_name= server1 |
| 126 |
--source include/rpl_connection.inc |
| 127 |
|
| 128 |
UNINSTALL PLUGIN clone; |
| 129 |
|
| 130 |
DROP TABLE test.t1; |
| 131 |
|
| 132 |
--source include/rpl_sync.inc |
| 133 |
|
| 134 |
--let $rpl_connection_name= server2 |
| 135 |
--source include/rpl_connection.inc |
| 136 |
|
| 137 |
UNINSTALL PLUGIN clone; |
| 138 |
|
| 139 |
RESET PERSIST group_replication_group_name; |
| 140 |
RESET PERSIST group_replication_local_address; |
| 141 |
RESET PERSIST group_replication_group_seeds; |
| 142 |
RESET PERSIST group_replication_start_on_boot; |
| 143 |
RESET PERSIST group_replication_consistency; |
| 144 |
RESET PERSIST group_replication_communication_stack; |
| 145 |
|
| 146 |
|
| 147 |
--replace_result $_group_replication_start_on_boot START_ON_BOOT_VALUE |
| 148 |
--eval SET GLOBAL group_replication_start_on_boot= $_group_replication_start_on_boot |
| 149 |
|
| 150 |
--replace_result $_group_replication_consistency_save GROUP_REPLICATION_CONSISTENCY |
| 151 |
--eval SET GLOBAL group_replication_consistency = $_group_replication_consistency_save |
| 152 |
|
| 153 |
--replace_result $_group_replication_clone_threshold_save GROUP_REPLICATION_CLONE_THRESHOLD |
| 154 |
--eval SET GLOBAL group_replication_clone_threshold= $_group_replication_clone_threshold_save |
| 155 |
|
| 156 |
set session sql_log_bin=0; |
| 157 |
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*"); |
| 158 |
call mtr.add_suppression("Clone removing all user data for provisioning: Started"); |
| 159 |
call mtr.add_suppression("Clone removing all user data for provisioning: Finished"); |
| 160 |
set session sql_log_bin=1; |
| 161 |
|
| 162 |
--source include/clean_monitoring_process.inc |
| 163 |
|
| 164 |
--source include/group_replication_end.inc |