Skip to content

Commit

Permalink
Merge branch 'master' into mariadb-dump
Browse files Browse the repository at this point in the history
  • Loading branch information
lance6716 authored Nov 10, 2024
2 parents 7691d9e + 5b7ff06 commit a0f31da
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
15 changes: 8 additions & 7 deletions cmd/go-mysqlbinlog/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,14 @@ func main() {
ServerID: 101,
Flavor: *flavor,

Host: *host,
Port: uint16(*port),
User: *user,
Password: *password,
RawModeEnabled: *rawMode,
SemiSyncEnabled: *semiSync,
UseDecimal: true,
Host: *host,
Port: uint16(*port),
User: *user,
Password: *password,
RawModeEnabled: *rawMode,
SemiSyncEnabled: *semiSync,
UseDecimal: true,
MaxReconnectAttempts: 10,
}

b := replication.NewBinlogSyncer(cfg)
Expand Down
10 changes: 8 additions & 2 deletions replication/binlogsyncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -749,12 +749,18 @@ func (b *BinlogSyncer) onStream(s *BinlogStreamer) {
b.retryCount++
if err = b.retrySync(); err != nil {
if b.cfg.MaxReconnectAttempts > 0 && b.retryCount >= b.cfg.MaxReconnectAttempts {
b.cfg.Logger.Errorf("retry sync err: %v, exceeded max retries (%d)", err, b.cfg.MaxReconnectAttempts)
b.cfg.Logger.Errorf(
"retry sync err: %v, exceeded max retries (%d)",
err, b.cfg.MaxReconnectAttempts,
)
s.closeWithError(err)
return
}

b.cfg.Logger.Errorf("retry sync err: %v, wait 1s and retry again", err)
b.cfg.Logger.Errorf(
"retry sync err: %v, wait 1s and retry again (retries: %d/%d)",
err, b.retryCount, b.cfg.MaxReconnectAttempts,
)
continue
}
}
Expand Down

0 comments on commit a0f31da

Please sign in to comment.