Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
Thread:
Lists: pgsql-committerspgsql-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

pgsql-hackers by date

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

pgsql-committers by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group