Skip to content

Commit

Permalink
DM(syncer): fix syncer may be dead cycle when access match inject ddl…
Browse files Browse the repository at this point in the history
… repeatedly by special ddls (#5016) (#5057)

close #5009
  • Loading branch information
ti-chi-bot authored Mar 29, 2022
1 parent 3b46dc1 commit 0c38e62
Show file tree
Hide file tree
Showing 2 changed files with 399 additions and 31 deletions.
8 changes: 8 additions & 0 deletions dm/syncer/err-operator/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,14 @@ func (h *Holder) MatchAndApply(startLocation, endLocation binlog.Location, curre
return false, pb.ErrorOp_InvalidErrorOp
}

if operator.op == pb.ErrorOp_Inject {
// if last event's position already equals currentEvent, this is repeatedly match, need remove last event before recalculate
if last := operator.events[len(operator.events)-1]; last.Header.LogPos == currentEvent.Header.LogPos {
h.logger.Info("re-match and apply a inject operator", zap.Stringer("startlocation", startLocation), zap.Stringer("endlocation", endLocation), zap.Stringer("operator", operator))
return true, operator.op
}
}

// set LogPos as start position
for _, ev := range operator.events {
ev.Header.LogPos = startLocation.Position.Pos
Expand Down
Loading

0 comments on commit 0c38e62

Please sign in to comment.