From a00d62864cc044944e61b8318505176a4270ed73 Mon Sep 17 00:00:00 2001 From: lance6716 Date: Fri, 5 Aug 2022 10:43:26 +0800 Subject: [PATCH 1/2] test(dm): inject error to a not-auto-resume source Signed-off-by: lance6716 --- dm/tests/shardddl2/run.sh | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/dm/tests/shardddl2/run.sh b/dm/tests/shardddl2/run.sh index 30aa8c326c8..dbb9dd66d7c 100644 --- a/dm/tests/shardddl2/run.sh +++ b/dm/tests/shardddl2/run.sh @@ -308,7 +308,7 @@ function DM_DROP_COLUMN_EXEC_ERROR() { function DM_DROP_COLUMN_ALL_DONE_CASE() { # get worker of source1 w="1" - got=$(grep -a "mysql-replica-01" $WORK_DIR/worker1/log/dm-worker.log | wc -l) + got=$(grep -a "mysql-replica-02" $WORK_DIR/worker1/log/dm-worker.log | wc -l) if [[ "$got" -eq 0 ]]; then w="2" fi @@ -317,40 +317,32 @@ function DM_DROP_COLUMN_ALL_DONE_CASE() { run_sql_source1 "insert into ${shardddl1}.${tb1} values(1,'aaa');" run_sql_source2 "insert into ${shardddl1}.${tb1} values(2,'bbb');" - run_sql_source2 "insert into ${shardddl1}.${tb2} values(3,'ccc');" - run_sql_source2 "alter table ${shardddl1}.${tb1} drop column b;" + run_sql_source1 "alter table ${shardddl1}.${tb1} drop column b;" check_log_contain_with_retry 'finish to handle ddls in optimistic shard mode.*tb1 drop column' \ $WORK_DIR/worker1/log/dm-worker.log $WORK_DIR/worker2/log/dm-worker.log - run_sql_source1 "alter table ${shardddl1}.${tb1} drop column b;" + run_sql_source2 "alter table ${shardddl1}.${tb1} drop column b;" run_dm_ctl_with_retry $WORK_DIR "127.0.0.1:$MASTER_PORT" \ "query-status test" \ "execute .* error" 1 - run_sql_source2 "alter table ${shardddl1}.${tb2} drop column b;" - check_log_contain_with_retry 'finish to handle ddls in optimistic shard mode.*tb2 drop column' \ - $WORK_DIR/worker1/log/dm-worker.log $WORK_DIR/worker2/log/dm-worker.log - restart_master run_sql_source1 "insert into ${shardddl1}.${tb1} values(4);" run_sql_source2 "insert into ${shardddl1}.${tb1} values(5);" - run_sql_source2 "insert into ${shardddl1}.${tb2} values(6);" - run_sql_source2 "alter table ${shardddl1}.${tb1} add column b varchar(10);" + run_sql_source1 "alter table ${shardddl1}.${tb1} add column b varchar(10);" run_dm_ctl_with_retry $WORK_DIR "127.0.0.1:$MASTER_PORT" \ "query-status test" \ "because schema conflict detected" 1 \ "add column b that wasn't fully dropped in downstream" 1 restart_worker $w "" - run_sql_source2 "alter table ${shardddl1}.${tb2} add column b varchar(10);" - run_sql_source1 "alter table ${shardddl1}.${tb1} add column b varchar(10);" + run_sql_source2 "alter table ${shardddl1}.${tb1} add column b varchar(10);" run_sql_source1 "insert into ${shardddl1}.${tb1} values(7,'ddd');" run_sql_source2 "insert into ${shardddl1}.${tb1} values(8,'eee');" - run_sql_source2 "insert into ${shardddl1}.${tb2} values(9,'fff');" run_dm_ctl_with_retry $WORK_DIR "127.0.0.1:$MASTER_PORT" \ "query-status test" \ @@ -361,8 +353,7 @@ function DM_DROP_COLUMN_ALL_DONE_CASE() { function DM_DROP_COLUMN_ALL_DONE() { run_case DROP_COLUMN_ALL_DONE "double-source-optimistic" \ "run_sql_source1 \"create table ${shardddl1}.${tb1} (a int primary key, b varchar(10));\"; \ - run_sql_source2 \"create table ${shardddl1}.${tb1} (a int primary key, b varchar(10));\"; \ - run_sql_source2 \"create table ${shardddl1}.${tb2} (a int primary key, b varchar(10));\"" \ + run_sql_source2 \"create table ${shardddl1}.${tb1} (a int primary key, b varchar(10));\"" \ "clean_table" "optimistic" } From 5f6be53ebecdcf651ff7a64a371c1cc5e56091e3 Mon Sep 17 00:00:00 2001 From: lance6716 Date: Mon, 8 Aug 2022 11:16:36 +0800 Subject: [PATCH 2/2] Apply suggestions from code review --- dm/tests/shardddl2/run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dm/tests/shardddl2/run.sh b/dm/tests/shardddl2/run.sh index dbb9dd66d7c..e744700e566 100644 --- a/dm/tests/shardddl2/run.sh +++ b/dm/tests/shardddl2/run.sh @@ -306,7 +306,7 @@ function DM_DROP_COLUMN_EXEC_ERROR() { } function DM_DROP_COLUMN_ALL_DONE_CASE() { - # get worker of source1 + # get worker of source2 w="1" got=$(grep -a "mysql-replica-02" $WORK_DIR/worker1/log/dm-worker.log | wc -l) if [[ "$got" -eq 0 ]]; then