From: Simon Riggs Date: Fri, 13 Jan 2012 12:59:08 +0000 (+0000) Subject: Minor but necessary improvements to WAL keepalives X-Git-Tag: REL9_2_BETA1~591 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3f1787c253967617a0e34fa4bfb7b2ab184ad484;p=postgresql Minor but necessary improvements to WAL keepalives Fujii Masao --- diff --git a/src/backend/replication/walreceiver.c b/src/backend/replication/walreceiver.c index ee595714e7..ee8ba5ec21 100644 --- a/src/backend/replication/walreceiver.c +++ b/src/backend/replication/walreceiver.c @@ -750,7 +750,8 @@ ProcessWalSndrMessage(XLogRecPtr walEnd, TimestampTz sendTime) walrcv->lastMsgReceiptTime = lastMsgReceiptTime; 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(lastMsgReceiptTime), GetReplicationApplyDelay(), diff --git a/src/backend/replication/walsender.c b/src/backend/replication/walsender.c index 3598e56f9d..3611713434 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)