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

DM(syncer): fix syncer may be dead cycle when access match inject ddl repeatedly by special ddls #5016

Merged
merged 7 commits into from
Mar 29, 2022
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