Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions canal/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"time"

"github.com/pingcap/errors"
"github.com/satori/go.uuid"
uuid "github.com/satori/go.uuid"
"github.com/siddontang/go-log/log"
"github.com/siddontang/go-mysql/mysql"
"github.com/siddontang/go-mysql/replication"
Expand Down Expand Up @@ -92,14 +92,14 @@ func (c *Canal) runSyncBinlog() error {
}
continue
case *replication.XIDEvent:
if e.GSet != nil {
c.master.UpdateGTIDSet(e.GSet)
}
savePos = true
// try to save the position later
if err := c.eventHandler.OnXID(pos); err != nil {
return errors.Trace(err)
}
if e.GSet != nil {
c.master.UpdateGTIDSet(e.GSet)
}
case *replication.MariadbGTIDEvent:
// try to save the GTID later
gtid, err := mysql.ParseMariadbGTIDSet(e.GTID.String())
Expand All @@ -119,9 +119,6 @@ func (c *Canal) runSyncBinlog() error {
return errors.Trace(err)
}
case *replication.QueryEvent:
if e.GSet != nil {
c.master.UpdateGTIDSet(e.GSet)
}
var (
mb [][]byte
db []byte
Expand Down Expand Up @@ -159,6 +156,9 @@ func (c *Canal) runSyncBinlog() error {
if err = c.eventHandler.OnDDL(pos, e); err != nil {
return errors.Trace(err)
}
if e.GSet != nil {
c.master.UpdateGTIDSet(e.GSet)
}
default:
continue
}
Expand Down