Skip to content

Commit

Permalink
Reading pg walsender.c, it seems repl keep alive is based on receivin…
Browse files Browse the repository at this point in the history
…g replication messages,

so send standby status instead of plain ping
  • Loading branch information
serprex committed Feb 9, 2024
1 parent 7e24789 commit 807c193
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion flow/connectors/postgres/postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,13 @@ func (c *PostgresConnector) ReplKeepAlive() (time.Duration, error) {
func (c *PostgresConnector) ReplPing() error {
if c.replLock.TryLock() {
defer c.replLock.Unlock()
return c.replConn.Ping(c.ctx)
if c.replState != nil {
return pglogrepl.SendStandbyStatusUpdate(
c.ctx,
c.replConn.PgConn(),
pglogrepl.StandbyStatusUpdate{WALWritePosition: c.replState.Offset},
)
}
}
return nil
}
Expand Down

0 comments on commit 807c193

Please sign in to comment.