diff --git a/dm/tests/shardddl2/run.sh b/dm/tests/shardddl2/run.sh index 8f5f5985da8..1e1f8e4cb24 100644 --- a/dm/tests/shardddl2/run.sh +++ b/dm/tests/shardddl2/run.sh @@ -302,9 +302,9 @@ 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 "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 @@ -313,40 +313,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" \ @@ -357,8 +349,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" }