Re: Suppressing useless wakeups in walreceiver - Mailing list pgsql-hackers

From Bharath Rupireddy
Subject Re: Suppressing useless wakeups in walreceiver
Date
Msg-id CALj2ACV-sjbTvzwRwsQEo0kJHRO=ZGpf2aWmxQ2px+A3wEH=fg@mail.gmail.com
Whole thread Raw
In response to Re: Suppressing useless wakeups in walreceiver  (Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>)
Responses Re: Suppressing useless wakeups in walreceiver  (Nathan Bossart <nathandbossart@gmail.com>)
List pgsql-hackers
On Tue, Oct 11, 2022 at 11:22 PM Nathan Bossart
<nathandbossart@gmail.com> wrote:
>
> On Tue, Oct 11, 2022 at 09:34:25AM +0530, Bharath Rupireddy wrote:
> > now = t1;
> > XLogWalRcvSendReply() /* say it ran for a minute or so for whatever reasons */
> > XLogWalRcvSendHSFeedback() /* with patch walrecevier sends hot standby
> > feedback more often without properly honouring
> > wal_receiver_status_interval because the 'now' isn't actually the
> > current time as far as that function is concerned, it is
> > t1 + XLogWalRcvSendReply()'s time. */
> >
> > Well, is this really a problem? I'm not sure about that. Let's hear from others.
>
> For this example, the feedback message would just be sent in the next loop
> iteration instead.

I think the hot standby feedback message gets sent too frequently
without honouring the wal_receiver_status_interval because the 'now'
is actually not the current time with your patch but 'now +
XLogWalRcvSendReply()'s time'. However, it's possible that I may be
wrong here.

        /*
         * Send feedback at most once per wal_receiver_status_interval.
         */
        if (!TimestampDifferenceExceeds(sendTime, now,
                                        wal_receiver_status_interval * 1000))
            return;

As said upthread [1], I think the best way to move forward is to
separate the GetCurrentTimestamp() calls optimizations into 0003.

Do you have any further thoughts on review comments posted upthread [1]?

[1] https://www.postgresql.org/message-id/CALj2ACV5q2dbVRKwu2PL2s_YY0owZFTRxLdX%3Dt%2BdZ1iag15khA%40mail.gmail.com

-- 
Bharath Rupireddy
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com



pgsql-hackers by date:

Previous
From: Etsuro Fujita
Date:
Subject: Re: Fast COPY FROM based on batch insert
Next
From: Bharath Rupireddy
Date:
Subject: Re: Move backup-related code to xlogbackup.c/.h