Skip to content

Commit

Permalink
shardddl: return error if conflict happened when receive conflict det…
Browse files Browse the repository at this point in the history
…ect operation (#9263) (#9267)

close #9280
  • Loading branch information
ti-chi-bot authored Jun 21, 2023
1 parent b5dc8fa commit 33e21a7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
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

0 comments on commit 33e21a7

Please sign in to comment.