Skip to content

feat: handle subevents in transaction payload event #827

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 11, 2023
Merged
Changes from 1 commit
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
17 changes: 17 additions & 0 deletions canal/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,23 @@ func (c *Canal) runSyncBinlog() error {
}
}
continue
case *replication.TransactionPayloadEvent:
// handle subevent row by row
ev := ev.Event.(*replication.TransactionPayloadEvent)
for _, subEvent := range ev.Events {
err = c.handleRowsEvent(subEvent)
if err != nil {
e := errors.Cause(err)
// if error is not ErrExcludedTable or ErrTableNotExist or ErrMissingTableMeta, stop canal
if e != ErrExcludedTable &&
e != schema.ErrTableNotExist &&
e != schema.ErrMissingTableMeta {
c.cfg.Logger.Errorf("handle transaction payload rows event at (%s, %d) error %v", pos.Name, curPos, err)
return errors.Trace(err)
}
}
}
continue
case *replication.XIDEvent:
savePos = true
// try to save the position later
Expand Down