From 807c19315a2e13efe29bf001ff1a20ee2c0d9153 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20Dub=C3=A9?= Date: Thu, 8 Feb 2024 16:34:04 +0000 Subject: [PATCH] Reading pg walsender.c, it seems repl keep alive is based on receiving replication messages, so send standby status instead of plain ping --- flow/connectors/postgres/postgres.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/flow/connectors/postgres/postgres.go b/flow/connectors/postgres/postgres.go index 7c98a8c6ea..b322822948 100644 --- a/flow/connectors/postgres/postgres.go +++ b/flow/connectors/postgres/postgres.go @@ -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 }