Commit 3f1787c2 authored by Simon Riggs's avatar Simon Riggs

Minor but necessary improvements to WAL keepalives

Fujii Masao
parent 21b446dd
...@@ -750,7 +750,8 @@ ProcessWalSndrMessage(XLogRecPtr walEnd, TimestampTz sendTime) ...@@ -750,7 +750,8 @@ ProcessWalSndrMessage(XLogRecPtr walEnd, TimestampTz sendTime)
walrcv->lastMsgReceiptTime = lastMsgReceiptTime; walrcv->lastMsgReceiptTime = lastMsgReceiptTime;
SpinLockRelease(&walrcv->mutex); SpinLockRelease(&walrcv->mutex);
elog(DEBUG2, "sendtime %s receipttime %s replication apply delay %d transfer latency %d", if (log_min_mesages <= DEBUG2)
elog(DEBUG2, "sendtime %s receipttime %s replication apply delay %d ms transfer latency %d ms",
timestamptz_to_str(sendTime), timestamptz_to_str(sendTime),
timestamptz_to_str(lastMsgReceiptTime), timestamptz_to_str(lastMsgReceiptTime),
GetReplicationApplyDelay(), GetReplicationApplyDelay(),
......
...@@ -834,7 +834,12 @@ WalSndLoop(void) ...@@ -834,7 +834,12 @@ WalSndLoop(void)
if (pq_is_send_pending()) if (pq_is_send_pending())
wakeEvents |= WL_SOCKET_WRITEABLE; wakeEvents |= WL_SOCKET_WRITEABLE;
else else
{
WalSndKeepalive(output_message); WalSndKeepalive(output_message);
/* Try to flush pending output to the client */
if (pq_flush_if_writable() != 0)
break;
}
/* Determine time until replication timeout */ /* Determine time until replication timeout */
if (replication_timeout > 0) if (replication_timeout > 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment