From 18c34391ac13e24098cfb89053ec632db45601cd Mon Sep 17 00:00:00 2001 From: csuzhangxc Date: Tue, 15 Sep 2020 16:17:01 +0800 Subject: [PATCH 1/2] syncer: do not ignore fake rotate event to the next file --- syncer/syncer.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/syncer/syncer.go b/syncer/syncer.go index 93e0b364d2..8f845ca38e 100644 --- a/syncer/syncer.go +++ b/syncer/syncer.go @@ -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 binlgo file, ignore it + } } *ec.currentLocation = binlog.Location{ From afa0b9b12fd2742c34e1b2d759475fc6d610b39d Mon Sep 17 00:00:00 2001 From: lance6716 Date: Tue, 15 Sep 2020 17:18:02 +0800 Subject: [PATCH 2/2] Update syncer/syncer.go --- syncer/syncer.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syncer/syncer.go b/syncer/syncer.go index 8f845ca38e..fef973a1fe 100644 --- a/syncer/syncer.go +++ b/syncer/syncer.go @@ -1499,7 +1499,7 @@ type eventContext struct { func (s *Syncer) handleRotateEvent(ev *replication.RotateEvent, ec eventContext) error { 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 binlgo file, ignore it + return nil // not rotate to the next binlog file, ignore it } }