Skip to content

Commit

Permalink
This is an automated cherry-pick of pingcap#6624
Browse files Browse the repository at this point in the history
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
  • Loading branch information
lance6716 authored and ti-chi-bot committed Aug 8, 2022
1 parent a56c39c commit b5f2f40
Showing 1 changed file with 10 additions and 15 deletions.
25 changes: 10 additions & 15 deletions dm/tests/shardddl2/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -302,9 +302,13 @@ function DM_DROP_COLUMN_EXEC_ERROR() {
}

function DM_DROP_COLUMN_ALL_DONE_CASE() {
# get worker of source1
# get worker of source2
w="1"
<<<<<<< HEAD
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)
>>>>>>> 1e7b84040 (test(dm): inject error to a not-auto-resume source (#6624))
if [[ "$got" -eq 0 ]]; then
w="2"
fi
Expand All @@ -313,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" \
Expand All @@ -357,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"
}

Expand Down

0 comments on commit b5f2f40

Please sign in to comment.