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

syncer: do not ignore fake rotate event to the next file (#1039) #1041

Merged
merged 2 commits into from
Sep 16, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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