| 1 |
# Test clone with concurrent alter ADD and DROP |
| 2 |
--source include/have_debug_sync.inc |
| 3 |
|
| 4 |
--replace_result $CLONE_PLUGIN CLONE_PLUGIN |
| 5 |
--eval INSTALL PLUGIN clone SONAME '$CLONE_PLUGIN' |
| 6 |
|
| 7 |
--let $algorithm = COPY |
| 8 |
|
| 9 |
if($in_place_ddl) { |
| 10 |
--let $algorithm = INPLACE |
| 11 |
} |
| 12 |
|
| 13 |
SET GLOBAL innodb_ddl_threads = 1; |
| 14 |
|
| 15 |
--source ../include/create_ddl_schema.inc |
| 16 |
|
| 17 |
## Restart server without loading all tablespaces. This would force |
| 18 |
## Clone to load the tablespaces with concurrent DDL |
| 19 |
if ($skip_space_validation) { |
| 20 |
--let restart_parameters=restart: --skip-innodb-validate-tablespace-paths |
| 21 |
--source include/restart_mysqld.inc |
| 22 |
} |
| 23 |
|
| 24 |
--let $dml_stmt_check = call execute_dml(1, 0, 100, 100, 10, 0) |
| 25 |
|
| 26 |
--echo # 1. ALTER TABLE ADD COLUMN while clone in progress |
| 27 |
--let $ddl_op1 = ALTER TABLE |
| 28 |
--let $ddl_stmt1 = ADD COLUMN col5 int, ALGORITHM=$algorithm |
| 29 |
|
| 30 |
--let $dml_stmt1 = CALL execute_dml(0, 0, 100, 100, 10, 0) |
| 31 |
--let $dml_stmt11 = INSERT INTO t11 SELECT col1, col2, col3, col4, col2 + 100 FROM t ON DUPLICATE KEY UPDATE col2 = t11.col2 + 1; |
| 32 |
|
| 33 |
--let $dml_stmt2 = CALL execute_dml(0, 0, 100, 100, 10, 0) |
| 34 |
--let $dml_stmt21 = INSERT INTO t21 SELECT col1, col2, col3, col4, col2 + 100 FROM t ON DUPLICATE KEY UPDATE col2 = t21.col2 + 1; |
| 35 |
|
| 36 |
--source ../include/ddl_common.inc |
| 37 |
|
| 38 |
--echo # 2. ALTER TABLE DROP COLUMN while clone in progress |
| 39 |
--let $ddl_op1 = ALTER TABLE |
| 40 |
--let $ddl_stmt1 = DROP COLUMN col5, ALGORITHM=$algorithm |
| 41 |
|
| 42 |
--let $dml_stmt1 = call execute_dml(1, 0, 100, 100, 10, 0) |
| 43 |
--let $dml_stmt11 = INSERT INTO t11 SELECT * FROM t ON DUPLICATE KEY UPDATE col2 = t11.col2 + 1; |
| 44 |
--let $dml_stmt2 = call execute_dml(1, 0, 100, 100, 10, 0) |
| 45 |
--let $dml_stmt21 = INSERT INTO t21 SELECT * FROM t ON DUPLICATE KEY UPDATE col2 = t21.col2 + 1; |
| 46 |
|
| 47 |
--source ../include/ddl_common.inc |
| 48 |
|
| 49 |
--echo # 3. ADD INDEX while clone in progress |
| 50 |
SET GLOBAL innodb_ddl_threads = 1; |
| 51 |
--let $ddl_op1 = ALTER TABLE |
| 52 |
--let $ddl_stmt1 = ADD INDEX col2_idx(col2), ALGORITHM=$algorithm |
| 53 |
|
| 54 |
--let $dml_stmt1 = CALL execute_dml(0, 0, 100, 100, 10, 0) |
| 55 |
--let $dml_stmt11 = INSERT INTO t11 SELECT * FROM t ON DUPLICATE KEY UPDATE col2 = t11.col2 + 1; |
| 56 |
|
| 57 |
--let $dml_stmt2 = CALL execute_dml(0, 0, 100, 100, 10, 0) |
| 58 |
--let $dml_stmt21 = INSERT INTO t21 SELECT * FROM t ON DUPLICATE KEY UPDATE col2 = t21.col2 + 1; |
| 59 |
|
| 60 |
--source ../include/ddl_common.inc |
| 61 |
|
| 62 |
# Reset space validation to restart the server back in normal mode |
| 63 |
# after test is over. This step is required just before the last |
| 64 |
# test execution of ddl_common.inc |
| 65 |
if ($skip_space_validation) { |
| 66 |
--let $skip_space_validation = |
| 67 |
} |
| 68 |
|
| 69 |
--echo # 4. DROP INDEX while clone in progress |
| 70 |
--let $ddl_op1 = ALTER TABLE |
| 71 |
--let $ddl_stmt1 = DROP INDEX col2_idx, ALGORITHM=$algorithm |
| 72 |
|
| 73 |
--let $dml_stmt1 = CALL execute_dml(0, 0, 100, 100, 10, 0) |
| 74 |
--let $dml_stmt11 = INSERT INTO t11 SELECT * FROM t ON DUPLICATE KEY UPDATE col2 = t11.col2 + 1; |
| 75 |
|
| 76 |
--let $dml_stmt2 = CALL execute_dml(0, 0, 100, 100, 10, 0) |
| 77 |
--let $dml_stmt21 = INSERT INTO t21 SELECT * FROM t ON DUPLICATE KEY UPDATE col2 = t21.col2 + 1; |
| 78 |
|
| 79 |
--source ../include/ddl_common.inc |
| 80 |
|
| 81 |
--echo # Cleanup |
| 82 |
--let $ddl_drop_schema_tables = 1 |
| 83 |
--let $ddl_drop_tables = 1 |
| 84 |
--source ../include/drop_ddl_schema.inc |
| 85 |
|
| 86 |
SET GLOBAL innodb_ddl_threads = default; |
| 87 |
--echo # Uninstall clone |
| 88 |
UNINSTALL PLUGIN clone; |