Skip to content

Commit dbe0224

Browse files
WangXiangUSTCsiddontang
authored andcommitted
skip event if parse failed (#394)
1 parent 9b07603 commit dbe0224

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

canal/sync.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ func (c *Canal) runSyncBinlog() error {
4444
force := false
4545
for {
4646
ev, err := s.GetEvent(c.ctx)
47-
4847
if err != nil {
4948
return errors.Trace(err)
5049
}
@@ -57,7 +56,7 @@ func (c *Canal) runSyncBinlog() error {
5756
pos := c.master.Position()
5857

5958
curPos := pos.Pos
60-
//next binlog pos
59+
// next binlog pos
6160
pos.Pos = ev.Header.LogPos
6261

6362
// We only save position with RotateEvent and XIDEvent.
@@ -118,8 +117,8 @@ func (c *Canal) runSyncBinlog() error {
118117
case *replication.QueryEvent:
119118
stmts, _, err := c.parser.Parse(string(e.Query), "", "")
120119
if err != nil {
121-
log.Errorf("parse query(%s) err %v", e.Query, err)
122-
return errors.Trace(err)
120+
log.Errorf("parse query(%s) err %v, will skip this event", e.Query, err)
121+
continue
123122
}
124123
for _, stmt := range stmts {
125124
nodes := parseStmt(stmt)

0 commit comments

Comments
 (0)