| 1 |
############################################################################### |
| 2 |
# This test evaluates that when donor and joiner have a different server |
| 3 |
# character set, recovery through clone will fail and will fall back to |
| 4 |
# incremental recovery. |
| 5 |
# |
| 6 |
# 1. Install clone and keyring plugins on server1. |
| 7 |
# 2. Bootstrap server1 and add some data |
| 8 |
# 3. Restart server 2 with a monitoring process (mysqld_safe) if needed |
| 9 |
# 4. Install the clone plugin on server2. |
| 10 |
# 5. Set server character set to latin1 (non-default) |
| 11 |
# 6. On a empty server2 start group replication |
| 12 |
# Clone will fail since the donor server character set utf8mb4 (default) is |
| 13 |
# different from joiner character set. Recovery will fallback to incremental. |
| 14 |
# 7. Cleanup |
| 15 |
############################################################################### |
| 16 |
--source include/have_mysqld_monitoring_process.inc |
| 17 |
--source include/have_clone_plugin.inc |
| 18 |
--source include/have_group_replication_plugin.inc |
| 19 |
--let $rpl_skip_group_replication_start= 1 |
| 20 |
--source include/group_replication.inc |
| 21 |
|
| 22 |
--let plugins = CLONE_PLUGIN,GROUP_REPLICATION,KEYRING_PLUGIN |
| 23 |
--source include/check_plugin_dir.inc |
| 24 |
|
| 25 |
--echo |
| 26 |
--echo ############################################################ |
| 27 |
--echo # 1. Install clone and keyring plugins on server1. |
| 28 |
|
| 29 |
--let $rpl_connection_name= server1 |
| 30 |
--source include/rpl_connection.inc |
| 31 |
|
| 32 |
--replace_result $CLONE_PLUGIN CLONE_PLUGIN |
| 33 |
--eval INSTALL PLUGIN clone SONAME '$CLONE_PLUGIN' |
| 34 |
|
| 35 |
--replace_result $KEYRING_PLUGIN KEYRING_PLUGIN |
| 36 |
--eval INSTALL PLUGIN keyring_file SONAME '$KEYRING_PLUGIN' |
| 37 |
|
| 38 |
--echo |
| 39 |
--echo ############################################################ |
| 40 |
--echo # 2. Bootstrap server1 and add some data |
| 41 |
|
| 42 |
--source include/start_and_bootstrap_group_replication.inc |
| 43 |
|
| 44 |
CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB; |
| 45 |
INSERT INTO t1 VALUES (1); |
| 46 |
INSERT INTO t1 VALUES (2); |
| 47 |
|
| 48 |
--echo |
| 49 |
--echo ####################################################################### |
| 50 |
--echo # 3. Restart server 2 with a monitoring process (mysqld_safe) if needed |
| 51 |
|
| 52 |
--let $rpl_connection_name= server2 |
| 53 |
--source include/rpl_connection.inc |
| 54 |
|
| 55 |
--let $_group_replication_local_address= `SELECT @@GLOBAL.group_replication_local_address` |
| 56 |
--let $_group_replication_group_seeds= `SELECT @@GLOBAL.group_replication_group_seeds` |
| 57 |
--let $_group_replication_comm_stack= `SELECT @@GLOBAL.group_replication_communication_stack` |
| 58 |
|
| 59 |
--let $plugin_list= $GROUP_REPLICATION |
| 60 |
--source include/spawn_monitoring_process.inc |
| 61 |
|
| 62 |
--echo |
| 63 |
--echo ############################################################ |
| 64 |
--echo # 4. Install the clone plugin on server2. |
| 65 |
|
| 66 |
--replace_result $CLONE_PLUGIN CLONE_PLUGIN |
| 67 |
--eval INSTALL PLUGIN clone SONAME '$CLONE_PLUGIN' |
| 68 |
|
| 69 |
--echo |
| 70 |
--echo ############################################################ |
| 71 |
--echo # 5. Set server character set to latin1 (non-default) |
| 72 |
|
| 73 |
SET @@global.character_set_server = latin5; |
| 74 |
|
| 75 |
--echo |
| 76 |
--echo ############################################################ |
| 77 |
--echo # 6. On a empty server2 start group replication |
| 78 |
--echo # Clone will fail since the donor server character set utf8mb4 (default) is |
| 79 |
--echo # different from joiner character set. Recovery will fallback to incremental. |
| 80 |
|
| 81 |
SET @group_replication_clone_threshold_saved = @@GLOBAL.group_replication_clone_threshold; |
| 82 |
SET GLOBAL group_replication_clone_threshold= 1; |
| 83 |
|
| 84 |
--disable_query_log |
| 85 |
--eval SET GLOBAL group_replication_local_address= "$_group_replication_local_address" |
| 86 |
--eval SET GLOBAL group_replication_group_seeds= "$_group_replication_group_seeds" |
| 87 |
--eval SET GLOBAL group_replication_communication_stack= "$_group_replication_comm_stack" |
| 88 |
--enable_query_log |
| 89 |
|
| 90 |
--source include/start_group_replication.inc |
| 91 |
|
| 92 |
--let $diff_tables=server1:test.t1 ,server2:test.t1 |
| 93 |
--source include/diff_tables.inc |
| 94 |
|
| 95 |
--let $assert_text= Clone should have failed |
| 96 |
--let $assert_cond= [SELECT state="Failed" FROM performance_schema.clone_status] = 1; |
| 97 |
--source include/assert.inc |
| 98 |
|
| 99 |
--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.2.err |
| 100 |
--let $assert_only_after = CURRENT_TEST: gr_clone_integration_error_fallback |
| 101 |
--let $assert_text = Clone failed |
| 102 |
--let $assert_select = There was an issue when cloning from another server: Error number: 3868 Error message: Clone Configuration character_set_server: Donor value: utf8mb4 is different from Recipient value: latin5.' |
| 103 |
--let $assert_count = 1 |
| 104 |
--source include/assert_grep.inc |
| 105 |
|
| 106 |
--echo |
| 107 |
--echo ############################################################ |
| 108 |
--echo # 7. Cleanup |
| 109 |
|
| 110 |
SET GLOBAL group_replication_clone_threshold= @group_replication_clone_threshold_saved; |
| 111 |
|
| 112 |
DROP TABLE t1; |
| 113 |
--source include/rpl_sync.inc |
| 114 |
|
| 115 |
--let $rpl_connection_name= server2 |
| 116 |
--source include/rpl_connection.inc |
| 117 |
|
| 118 |
--source include/clean_monitoring_process.inc |
| 119 |
|
| 120 |
set session sql_log_bin=0; |
| 121 |
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 1."); |
| 122 |
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: 3868"); |
| 123 |
call mtr.add_suppression("There was an issue when cloning from another server: Error number: 3868 Error message: Clone Configuration character_set_server: Donor value: utf8mb4 is different from Recipient value: latin5."); |
| 124 |
call mtr.add_suppression("Due to some issue on the previous step distributed recovery is now executing: Incremental Recovery."); |
| 125 |
set session sql_log_bin=1; |
| 126 |
|
| 127 |
--let $rpl_connection_name= server1 |
| 128 |
--source include/rpl_connection.inc |
| 129 |
|
| 130 |
UNINSTALL PLUGIN clone; |
| 131 |
UNINSTALL PLUGIN keyring_file; |
| 132 |
|
| 133 |
--remove_file $MYSQL_TMP_DIR/gr_clone_integration_error_fallback |
| 134 |
|
| 135 |
--let $rpl_connection_name= server2 |
| 136 |
--source include/rpl_connection.inc |
| 137 |
|
| 138 |
UNINSTALL PLUGIN clone; |
| 139 |
SET @@global.character_set_server = default; |
| 140 |
|
| 141 |
--source include/group_replication_end.inc |