Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(dm): inject error to a not-auto-resume source (#6624) #6655

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 7 additions & 16 deletions dm/tests/shardddl2/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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" \
Expand All @@ -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"
}

Expand Down