Re: [COMMITTERS] pgsql: Avoid archiving XLOG_RUNNING_XACTS on idle server - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: [COMMITTERS] pgsql: Avoid archiving XLOG_RUNNING_XACTS on idle server
Date
Msg-id CAB7nPqSyyzWHw5gbRBaJoQMOeLiNp5KnfmZT6K1DzBTxG3sYZA@mail.gmail.com
Whole thread Raw
In response to Re: [COMMITTERS] pgsql: Avoid archiving XLOG_RUNNING_XACTS on idle server  (Andres Freund <andres@anarazel.de>)
Responses Re: [COMMITTERS] pgsql: Avoid archiving XLOG_RUNNING_XACTS on idle server  (Simon Riggs <simon@2ndQuadrant.com>)
List pgsql-hackers
On Wed, Apr 6, 2016 at 9:27 PM, Andres Freund <andres@anarazel.de> wrote:
> On 2016-04-06 13:11:40 +0100, Simon Riggs wrote:
>> On 6 April 2016 at 10:09, Andres Freund <andres@anarazel.de> wrote:
>> > On 2016-04-06 10:04:42 +0100, Simon Riggs wrote:
>> > The issue there is that we continue to issue checkpoints if the only
>> > activity since the last checkpoint was emitting a standby
>> > snapshot. That's because:
>> >
>>
>> I agree this is the current situation in 9.4 and 9.5, hence the bug report.
>>
>> This no longer occurs with the patches I have proposed. The snapshot is
>> skipped, so a further checkpoint never triggers.
>
> Not if there's a longrunning/idle transaction.
>
> Note that skipping the snapshot is actually a *problem* in some
> cases. As I've brought up upthread, to which you never replied. A
> xl_running_xacts->xcnt == 0/!overflowed snapshot can be very important
> for hot standby, because it allows ProcArrayApplyRecoveryInfo() to
> switch to INITIALIZED state:
>         if (standbyState == STANDBY_SNAPSHOT_PENDING)
>         {
>                 /*
>                  * If the snapshot isn't overflowed or if its empty we can reset our
>                  * pending state and use this snapshot instead.
>                  */
>                 if (!running->subxid_overflow || running->xcnt == 0)
>                 {
>                         /*
>                          * If we have already collected known assigned xids, we need to
>                          * throw them away before we apply the recovery snapshot.
>                          */
>                         KnownAssignedXidsReset();
>                         standbyState = STANDBY_INITIALIZED;
>                 }

Yes. Such snapshot allows to initialize more quickly a hot standby...
And that's useful in some cases if the recovery is on a pending
snapshot (bgwriter standby snapshots help a lot with that btw).

>> > > > We now log more WAL with
>> > > > XLogArchiveTimeout > 0 than without.
>> >
>> > > And the problem with that is what?
>> >
>> > That an idle system unnecessarily produces WAL? Waking up disks and
>> > everything?
>> >
>>
>> The OP discussed a problem with archive_timeout > 0. Are you saying we
>> should put in a fix that applies whatever the setting of archive_timeout?
>
> Yes. We should strive to fix the full scope of an issue; not just the
> part complained about.
>
> You seem to ignore valid points made against your approach, apparently
> because you dismiss them as "emotive language". Stop.

Yeah... We have reached a clear consensus about the way things should
be done after quite a lot of discussions that has gone for a couple of
months. And Andres' design on the matter is what is getting approval
from everybody who has worked toward addressing this issue while
really taking care of the problem at its root. The patch, as currently
proposed, is a bandaid, and has been committed at the surprise of
everybody without any discussion.

Please let's revert this patch and really move toward fixing this
problem... Which is a way in short a way to fix the decision-making
for checkpoint skipping.
--
Michael


pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: [COMMITTERS] pgsql: Avoid archiving XLOG_RUNNING_XACTS on idle server
Next
From: Simon Riggs
Date:
Subject: Re: [COMMITTERS] pgsql: Avoid archiving XLOG_RUNNING_XACTS on idle server