diff --git a/dm/syncer/ddl.go b/dm/syncer/ddl.go index b8304c3b036..02e22cea54b 100644 --- a/dm/syncer/ddl.go +++ b/dm/syncer/ddl.go @@ -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)) } diff --git a/dm/tests/shardddl4_1/run.sh b/dm/tests/shardddl4_1/run.sh index b7914bf6fae..8cac95b6ad2 100644 --- a/dm/tests/shardddl4_1/run.sh +++ b/dm/tests/shardddl4_1/run.sh @@ -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 }