Skip to content
Merged
Changes from all commits
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
12 changes: 9 additions & 3 deletions internal/impl/mysql/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,15 @@ func (s *Snapshot) getCurrentBinlogPosition(ctx context.Context) (position, erro
executedGtidSet any
)

row := s.snapshotConn.QueryRowContext(ctx, "SHOW MASTER STATUS")
if err := row.Scan(&file, &offset, &binlogDoDB, &binlogIgnoreDB, &executedGtidSet); err != nil {
return position{}, err
scanRow := func(row *sql.Row) error {
return row.Scan(&file, &offset, &binlogDoDB, &binlogIgnoreDB, &executedGtidSet)
}

// "SHOW BINARY LOG STATUS" replaces "SHOW MASTER STATUS" IN MySQL 8.4+
if err := scanRow(s.snapshotConn.QueryRowContext(ctx, "SHOW BINARY LOG STATUS")); err != nil {
if err = scanRow(s.snapshotConn.QueryRowContext(ctx, "SHOW MASTER STATUS")); err != nil {
return position{}, err
}
}

return position{
Expand Down
Loading