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

shardddl: return error if conflict happened when receive conflict detect operation (#9263) #9267

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions dm/syncer/ddl.go
Original file line number Diff line number Diff line change
Expand Up @@ -851,6 +851,9 @@ func (ddl *Optimist) handleDDL(qec *queryEventContext) error {
if op.ConflictStage != optimism.ConflictDetected {
break
}
if ddl.strict {
return terror.ErrSyncerShardDDLConflict.Generate(qec.needHandleDDLs, op.ConflictMsg)
}
rev = op.Revision
ddl.logger.Info("operation conflict detected, waiting for resolve", zap.Stringer("info", info))
}
Expand Down
5 changes: 3 additions & 2 deletions dm/tests/shardddl4_1/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1217,13 +1217,14 @@ function DM_STRICT_OPTIMISTIC_SINGLE_SOURCE_CASE() {
run_sql_source1 "insert into ${shardddl1}.${tb1} values(1,1);"
run_sql_source1 "insert into ${shardddl1}.${tb2} values(2,2);"

run_sql_source1 "alter table ${shardddl1}.${tb1} add c int;"
run_sql_source1 "alter table ${shardddl1}.${tb1} add c int not null default 10;"
run_sql_source1 "insert into ${shardddl1}.${tb1} values(3,3,3);"
run_sql_source1 "insert into ${shardddl1}.${tb2} values(4,4);"

run_sql_source1 "alter table ${shardddl1}.${tb2} change b c int;"
run_sql_source1 "alter table ${shardddl1}.${tb2} add c varchar(30) not null default '10';"
run_dm_ctl_with_retry $WORK_DIR "127.0.0.1:$MASTER_PORT" \
"query-status test" \
'"stage": "Paused"' 1 \
"because schema conflict detected" 1
}

Expand Down