On Wed, Jan 11, 2012 at 2:05 PM, Fujii Masao <masao.fujii@gmail.com> wrote:
> On Sat, Dec 31, 2011 at 10:34 PM, Simon Riggs <simon@2ndquadrant.com> wrote:
>> Send new protocol keepalive messages to standby servers.
>> Allows streaming replication users to calculate transfer latency
>> and apply delay via internal functions. No external functions yet.
Thanks for further review.
> pq_flush_if_writable() needs to be called just after
> WalSndKeepalive(). Otherwise,
> keepalive packet is not sent for a while.
It will get sent though won't it? Maybe not immediately. I guess we
may as well flush though, since we're not doing anything else - by
definition. Will add.
> +static void
> +ProcessWalSndrMessage(XLogRecPtr walEnd, TimestampTz sendTime)
>
> walEnd is not used in ProcessWalSndrMessage() at all. Can't we remove it?
> If yes, walEnd field in WalSndrMessage is also not used anywhere, so ISTM
> we can remove it.
It's there to allow extension of the message processing to be more
complex than it currently is. Changing the protocol is much harder
than changing a function call.
I'd like to keep it since it doesn't have any negative effects.
> + elog(DEBUG2, "sendtime %s receipttime %s replication apply delay %d
> transfer latency %d",
> + timestamptz_to_str(sendTime),
> + timestamptz_to_str(lastMsgReceiptTime),
> + GetReplicationApplyDelay(),
> + GetReplicationTransferLatency());
>
> The unit of replication apply delay and transfer latency should be in
> log message.
OK, will do.
> GetReplicationApplyDelay() and GetReplicationTransferLatency() are called
> whenever the standby receives the message from the master. Which might
> degrade the performance of replication a bit. So we should skip the above elog
> when log_message >= DEBUG2?
OK, will put in a specific test for you.
--
Simon Riggs http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services