Re: [COMMITTERS] pgsql: Send new protocol keepalive messages to standby servers.

From: Simon Riggs <simon(at)2ndQuadrant(dot)com>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [COMMITTERS] pgsql: Send new protocol keepalive messages to standby servers.
Date: 2012-01-11 15:20:24
Message-ID: CA+U5nMJcC=71j41dgmACeXdKGdrZaL3Umf0Y8rV-R1_Qq+XA1w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On Wed, Jan 11, 2012 at 2:05 PM, Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:
> On Sat, Dec 31, 2011 at 10:34 PM, Simon Riggs <simon(at)2ndquadrant(dot)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

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Alvaro Herrera 2012-01-11 21:50:38 pgsql: Validate number of steps specified in permutation
Previous Message Fujii Masao 2012-01-11 14:05:46 Re: [COMMITTERS] pgsql: Send new protocol keepalive messages to standby servers.

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2012-01-11 15:21:33 Re: JSON for PG 9.2
Previous Message Robert Haas 2012-01-11 15:16:59 Re: [WIP] Double-write with Fast Checksums