| 1 |
# Test clone remote restart command |
| 2 |
|
| 3 |
--source include/have_debug.inc |
| 4 |
|
| 5 |
--let $CLONE_DATADIR = $MYSQL_TMP_DIR/data_new |
| 6 |
--let $HOST = 127.0.0.1 |
| 7 |
--let $PORT =`select @@port` |
| 8 |
--let $USER = root |
| 9 |
--let remote_clone = 1 |
| 10 |
|
| 11 |
CREATE TABLE t1(col1 INT PRIMARY KEY, col2 char(64)); |
| 12 |
|
| 13 |
INSERT INTO t1 VALUES(10, 'clone row 1'); |
| 14 |
INSERT INTO t1 VALUES(20, 'clone row 2'); |
| 15 |
INSERT INTO t1 VALUES(30, 'clone row 3'); |
| 16 |
|
| 17 |
SELECT * from t1 ORDER BY col1; |
| 18 |
|
| 19 |
# Install Clone Plugin |
| 20 |
--replace_result $CLONE_PLUGIN CLONE_PLUGIN |
| 21 |
--eval INSTALL PLUGIN clone SONAME '$CLONE_PLUGIN' |
| 22 |
|
| 23 |
SELECT PLUGIN_NAME, PLUGIN_STATUS FROM INFORMATION_SCHEMA.PLUGINS |
| 24 |
WHERE PLUGIN_NAME LIKE '%clone%'; |
| 25 |
|
| 26 |
SET GLOBAL CLONE_MAX_CONCURRENCY = 8; |
| 27 |
SHOW VARIABLES LIKE '%CLONE_MAX_CONCURRENCY%'; |
| 28 |
SET GLOBAL CLONE_MAX_CONCURRENCY = default; |
| 29 |
|
| 30 |
--echo # Clone failure by forcing network error and disabling restart |
| 31 |
SET GLOBAL CLONE_DONOR_TIMEOUT_AFTER_NETWORK_FAILURE = 0; |
| 32 |
SHOW VARIABLES LIKE 'CLONE_DONOR_TIMEOUT_AFTER_NETWORK_FAILURE'; |
| 33 |
|
| 34 |
SET global debug="+d,clone_restart_apply"; |
| 35 |
--let $clone_err = ER_CLONE_DONOR |
| 36 |
--source ../include/clone_command.inc |
| 37 |
--let $clone_err = 0 |
| 38 |
SET global debug="-d,clone_restart_apply"; |
| 39 |
--force-rmdir $CLONE_DATADIR |
| 40 |
|
| 41 |
--echo # Clone by forcing network error and allowing restart |
| 42 |
SET GLOBAL CLONE_DONOR_TIMEOUT_AFTER_NETWORK_FAILURE = 15; |
| 43 |
SHOW VARIABLES LIKE 'CLONE_DONOR_TIMEOUT_AFTER_NETWORK_FAILURE'; |
| 44 |
SET global debug="+d,clone_restart_apply"; |
| 45 |
--source ../include/clone_command.inc |
| 46 |
SET global debug="-d,clone_restart_apply"; |
| 47 |
|
| 48 |
# Restart server on cloned data directory |
| 49 |
--replace_result $CLONE_DATADIR CLONE_DATADIR |
| 50 |
--let restart_parameters="restart: --datadir=$CLONE_DATADIR" |
| 51 |
--source include/restart_mysqld.inc |
| 52 |
|
| 53 |
# Validate data |
| 54 |
SELECT * from t1 ORDER BY col1; |
| 55 |
INSERT INTO t1 VALUES(40, 'clone row 4'); |
| 56 |
SELECT * from t1 ORDER BY col1; |
| 57 |
|
| 58 |
#Cleanup |
| 59 |
--let restart_parameters="restart:" |
| 60 |
--source include/restart_mysqld.inc |
| 61 |
|
| 62 |
SELECT * from t1 ORDER BY col1; |
| 63 |
UNINSTALL PLUGIN clone; |
| 64 |
|
| 65 |
DROP TABLE t1; |
| 66 |
|
| 67 |
--force-rmdir $CLONE_DATADIR |