On Thu, Jan 12, 2012 at 10:37 AM, Fujii Masao <masao.fu...@gmail.com> wrote:
> On Thu, Jan 12, 2012 at 5:53 PM, Simon Riggs <si...@2ndquadrant.com> wrote:
>> PrimaryKeepaliveMessage is a message type that uses WalSndrMessage.
>> That message type is only sent when the WalSndr is quiet, so what is
>> the difference, in that case?
>
> Oh, you are right. There is no difference.

Here are the changes we discussed. Further comments before commit?

-- 
 Simon Riggs                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services
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)
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to