Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
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

+2-1
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

+5
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)