Skip to content

Commit

Permalink
fix pos save logic
Browse files Browse the repository at this point in the history
Signed-off-by: axfor <aixiaoxiang2009@hotmail.com>
  • Loading branch information
axfor committed Jun 23, 2023
1 parent 33e60ef commit 52ce4ff
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions canal/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ func (c *Canal) runSyncBinlog() error {
for _, stmt := range stmts {
nodes := parseDDLStmt(stmt)
if len(nodes) > 0 {
posInfo.SavePos = true
posInfo.Force = true
err := c.handleDDLEvent(ev, e, nodes, posInfo)
if err != nil {
c.cfg.Logger.Errorf("handle ddl event err %v", err)
Expand Down Expand Up @@ -233,6 +235,7 @@ func (c *Canal) updateTable(header *replication.EventHeader, db, table string) (
}
return
}

func (c *Canal) updateReplicationDelay(ev *replication.BinlogEvent) {
var newDelay uint32
now := uint32(time.Now().Unix())
Expand Down Expand Up @@ -356,8 +359,6 @@ func (c *Canal) handleDDLEvent(ev *replication.BinlogEvent, e *replication.Query
}
}
if len(nodes) > 0 {
pos.SavePos = true
pos.Force = true
// Now we only handle Table Changed DDL, maybe we will support more later.
if err := c.eventHandler.OnDDL(ev.Header, pos.Position, e); err != nil {
return errors.Trace(err)
Expand Down

0 comments on commit 52ce4ff

Please sign in to comment.