fujii_review_keepalives.v1.patch

text/x-patch

Filename: fujii_review_keepalives.v1.patch
Type: text/x-patch
Part: 0
Message: Re: Re: [COMMITTERS] pgsql: Send new protocol keepalive messages to standby servers.

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: unified
Series: patch v1
File+
src/backend/replication/walreceiver.c 1 1
src/backend/replication/walsender.c 5 0
diff --git a/src/backend/replication/walreceiver.c b/src/backend/replication/walreceiver.c
index ee59571..590e4a1 100644
--- a/src/backend/replication/walreceiver.c
+++ b/src/backend/replication/walreceiver.c
@@ -750,7 +750,7 @@ ProcessWalSndrMessage(XLogRecPtr walEnd, TimestampTz sendTime)
 	walrcv->lastMsgReceiptTime = lastMsgReceiptTime;
 	SpinLockRelease(&walrcv->mutex);
 
-	elog(DEBUG2, "sendtime %s receipttime %s replication apply delay %d transfer latency %d",
+	elog(DEBUG2, "sendtime %s receipttime %s replication apply delay %d ms transfer latency %d ms",
 					timestamptz_to_str(sendTime),
 					timestamptz_to_str(lastMsgReceiptTime),
 					GetReplicationApplyDelay(),
diff --git a/src/backend/replication/walsender.c b/src/backend/replication/walsender.c
index 3598e56..3611713 100644
--- a/src/backend/replication/walsender.c
+++ b/src/backend/replication/walsender.c
@@ -834,7 +834,12 @@ WalSndLoop(void)
 			if (pq_is_send_pending())
 				wakeEvents |= WL_SOCKET_WRITEABLE;
 			else
+			{
 				WalSndKeepalive(output_message);
+				/* Try to flush pending output to the client */
+				if (pq_flush_if_writable() != 0)
+					break;
+			}
 
 			/* Determine time until replication timeout */
 			if (replication_timeout > 0)