Skip to content

Commit 3f1787c

Browse files
Minor but necessary improvements to WAL keepalives
Fujii Masao
1 parent 21b446d commit 3f1787c

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/backend/replication/walreceiver.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,8 @@ ProcessWalSndrMessage(XLogRecPtr walEnd, TimestampTz sendTime)
750750
walrcv->lastMsgReceiptTime = lastMsgReceiptTime;
751751
SpinLockRelease(&walrcv->mutex);
752752

753-
elog(DEBUG2, "sendtime %s receipttime %s replication apply delay %d transfer latency %d",
753+
if (log_min_mesages <= DEBUG2)
754+
elog(DEBUG2, "sendtime %s receipttime %s replication apply delay %d ms transfer latency %d ms",
754755
timestamptz_to_str(sendTime),
755756
timestamptz_to_str(lastMsgReceiptTime),
756757
GetReplicationApplyDelay(),

src/backend/replication/walsender.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -834,7 +834,12 @@ WalSndLoop(void)
834834
if (pq_is_send_pending())
835835
wakeEvents |= WL_SOCKET_WRITEABLE;
836836
else
837+
{
837838
WalSndKeepalive(output_message);
839+
/* Try to flush pending output to the client */
840+
if (pq_flush_if_writable() != 0)
841+
break;
842+
}
838843

839844
/* Determine time until replication timeout */
840845
if (replication_timeout > 0)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy