| 1 |
# Test clone with different table types with debug sync |
| 2 |
|
| 3 |
--source include/have_debug_sync.inc |
| 4 |
--source include/count_sessions.inc |
| 5 |
|
| 6 |
call mtr.add_suppression("\\[Warning\\] .*MY-\\d+.* \\[Server\\] Found 1 prepared XA transactions"); |
| 7 |
|
| 8 |
## Install plugin |
| 9 |
--let $CLONE_DATADIR = $MYSQL_TMP_DIR/data_new |
| 10 |
|
| 11 |
--replace_result $CLONE_PLUGIN CLONE_PLUGIN |
| 12 |
--eval INSTALL PLUGIN clone SONAME '$CLONE_PLUGIN' |
| 13 |
|
| 14 |
## Create test schema |
| 15 |
--source ../include/create_schema.inc |
| 16 |
|
| 17 |
call execute_dml(0, 0, 10, 10, 1, 0); |
| 18 |
commit; |
| 19 |
|
| 20 |
--echo ## Test: Clone with XA transactions |
| 21 |
|
| 22 |
--echo # In connection con1 - Start XA prepare |
| 23 |
connect (con1,localhost,root,,); |
| 24 |
|
| 25 |
XA start 'xa_trx_1'; |
| 26 |
update t1 set col2 = 100; |
| 27 |
XA end 'xa_trx_1'; |
| 28 |
|
| 29 |
SET DEBUG_SYNC = 'xa_block_clone SIGNAL start_clone WAIT_FOR resume_xa_1'; |
| 30 |
--send XA prepare 'xa_trx_1' |
| 31 |
|
| 32 |
connection default; |
| 33 |
--echo # In connection default - Start Cloning database |
| 34 |
SET DEBUG_SYNC = 'now WAIT_FOR start_clone'; |
| 35 |
SET DEBUG_SYNC = 'clone_wait_xa SIGNAL resume_xa_1'; |
| 36 |
SET DEBUG_SYNC = 'clone_block_xa SIGNAL resume_xa_2 WAIT_FOR resume_clone'; |
| 37 |
--source ../include/clone_command_send.inc |
| 38 |
|
| 39 |
--echo # In connection con1 - Finish XA prepare, Start XA commit |
| 40 |
connection con1; |
| 41 |
--reap |
| 42 |
SET DEBUG_SYNC = 'now WAIT_FOR resume_xa_2'; |
| 43 |
SET DEBUG_SYNC = 'xa_wait_clone SIGNAL resume_clone'; |
| 44 |
--send XA commit 'xa_trx_1' |
| 45 |
|
| 46 |
connection default; |
| 47 |
--echo # In connection default - Finish Cloning database |
| 48 |
--reap |
| 49 |
|
| 50 |
--echo # In connection con1 - Finish XA Commit |
| 51 |
connection con1; |
| 52 |
--reap |
| 53 |
|
| 54 |
connection default; |
| 55 |
--echo # In connection default |
| 56 |
disconnect con1; |
| 57 |
|
| 58 |
SELECT count(*) from t1; |
| 59 |
SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1; |
| 60 |
|
| 61 |
--echo # Restart cloned database |
| 62 |
--replace_result $CLONE_DATADIR CLONE_DATADIR |
| 63 |
--let restart_parameters="restart: --datadir=$CLONE_DATADIR" |
| 64 |
--source include/restart_mysqld.inc |
| 65 |
|
| 66 |
# Check table in cloned database |
| 67 |
SHOW CREATE TABLE t1; |
| 68 |
SELECT count(*) from t1; |
| 69 |
SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1; |
| 70 |
|
| 71 |
XA recover; |
| 72 |
XA commit 'xa_trx_1'; |
| 73 |
|
| 74 |
SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1; |
| 75 |
|
| 76 |
# Execute procedure to delete all rows and insert |
| 77 |
call execute_dml(3, 0, 1, 1, 1, 0); |
| 78 |
call execute_dml(0, 0, 10, 10, 1, 0); |
| 79 |
|
| 80 |
SELECT count(*) from t1; |
| 81 |
SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1; |
| 82 |
|
| 83 |
# Restart and Remove cloned directory |
| 84 |
--let restart_parameters="restart:" |
| 85 |
--source include/restart_mysqld.inc |
| 86 |
--force-rmdir $CLONE_DATADIR |
| 87 |
|
| 88 |
# Cleanup |
| 89 |
--source ../include/drop_schema.inc |
| 90 |
|
| 91 |
UNINSTALL PLUGIN clone; |
| 92 |
SET DEBUG_SYNC = 'RESET'; |
| 93 |
|
| 94 |
--source include/wait_until_count_sessions.inc |