Skip to content
This repository has been archived by the owner on Nov 24, 2023. It is now read-only.

Commit

Permalink
syncer: do not ignore fake rotate event to the next file (#1039) (#1041)
Browse files Browse the repository at this point in the history
Co-authored-by: csuzhangxc <csuzhangxc@gmail.com>
Co-authored-by: lance6716 <lance6716@gmail.com>
  • Loading branch information
3 people committed Sep 16, 2020
1 parent 5b3ad8a commit 651943d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions syncer/syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -1497,9 +1497,10 @@ type eventContext struct {
// TODO: Further split into smaller functions and group common arguments into
// a context struct.
func (s *Syncer) handleRotateEvent(ev *replication.RotateEvent, ec eventContext) error {
if ec.header.Timestamp == 0 || ec.header.LogPos == 0 {
// it is fake rotate event, ignore it
return nil
if ec.header.Timestamp == 0 || ec.header.LogPos == 0 { // fake rotate event
if string(ev.NextLogName) <= ec.lastLocation.Position.Name {
return nil // not rotate to the next binlog file, ignore it
}
}

*ec.currentLocation = binlog.Location{
Expand Down

0 comments on commit 651943d

Please sign in to comment.