From 3345f5392ee1936537c2d7b78a9d085a2d7a07de Mon Sep 17 00:00:00 2001 From: Chunzhu Li Date: Thu, 17 Mar 2022 11:48:27 +0800 Subject: [PATCH] set skip and redirect error message for now --- dm/dm/master/shardddl/optimist.go | 1 + dm/syncer/optimist.go | 8 +++----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/dm/dm/master/shardddl/optimist.go b/dm/dm/master/shardddl/optimist.go index ea7b6fdfd1f..e6e7b84d936 100644 --- a/dm/dm/master/shardddl/optimist.go +++ b/dm/dm/master/shardddl/optimist.go @@ -744,6 +744,7 @@ func (o *Optimist) handleLock(info optimism.Info, tts []optimism.TargetTable, sk switch { case terror.ErrShardDDLOptimismNeedSkipAndRedirect.Equal(err): cfStage = optimism.ConflictSkipWaitRedirect + cfMsg = err.Error() o.logger.Warn("Please make sure all sharding tables execute this DDL in order", log.ShortError(err)) case terror.ErrShardDDLOptimismTrySyncFail.Equal(err): cfStage = optimism.ConflictDetected diff --git a/dm/syncer/optimist.go b/dm/syncer/optimist.go index ee22e17f042..fd00aac7e41 100644 --- a/dm/syncer/optimist.go +++ b/dm/syncer/optimist.go @@ -179,13 +179,11 @@ func (s *Syncer) handleQueryEventOptimistic(qec *queryEventContext) error { } } - if op.ConflictStage == optimism.ConflictError { - return terror.ErrSyncerShardDDLConflict.Generate(qec.needHandleDDLs, op.ConflictMsg) - } // TODO: support redirect for DM worker // return error to pass IT now - if op.ConflictStage == optimism.ConflictSkipWaitRedirect { - return terror.ErrSyncerShardDDLConflict.Generate(qec.needHandleDDLs, "there will be conflicts if DDLs .* are applied to the downstream. old table info: .*, new table info: .*") + switch op.ConflictStage { + case optimism.ConflictError, optimism.ConflictSkipWaitRedirect: + return terror.ErrSyncerShardDDLConflict.Generate(qec.needHandleDDLs, op.ConflictMsg) } // updated needHandleDDLs to DDLs received from DM-master.