Skip to content

Commit

Permalink
Skip binlog events without timestamp to find start timestamp
Browse files Browse the repository at this point in the history
Signed-off-by: Tamal Saha <[email protected]>
  • Loading branch information
tamalsaha committed Nov 20, 2023
1 parent 321a2a9 commit 2b6539e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions internal/databases/mysql/mysql_binlog.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,12 @@ func GetBinlogStartTimestamp(filename string, flavor string) (time.Time, error)
parser.SetFlavor(flavor)
parser.SetVerifyChecksum(false) // the faster, the better
parser.SetRawMode(true) // choose events to parse manually

err := parser.ParseFile(filename, 0, func(event *replication.BinlogEvent) error {
ts = event.Header.Timestamp
if ts == 0 {
return nil // keep reading until first event with timestamp is found
}
return fmt.Errorf("shallow file read finished")
})
if err != nil && ts == 0 {
Expand Down

0 comments on commit 2b6539e

Please sign in to comment.