Re: pgsql: Avoid archiving XLOG_RUNNING_XACTS on idle server

From: Andres Freund <andres(at)anarazel(dot)de>
To: Simon Riggs <simon(at)2ndQuadrant(dot)com>
Cc: pgsql-committers <pgsql-committers(at)postgresql(dot)org>
Subject: Re: pgsql: Avoid archiving XLOG_RUNNING_XACTS on idle server
Date: 2016-04-04 06:49:20
Message-ID: 20160404064919.GG2431@awork2.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On 2016-04-04 08:42:02 +0200, Andres Freund wrote:
> On 2016-04-04 07:31:46 +0100, Simon Riggs wrote:
> > On 4 April 2016 at 07:24, Andres Freund <andres(at)anarazel(dot)de> wrote:
> >
> > > On 2016-04-04 06:19:04 +0000, Simon Riggs wrote:
> > > > Avoid archiving XLOG_RUNNING_XACTS on idle server
> > > >
> > > > If archive_timeout > 0 we should avoid logging XLOG_RUNNING_XACTS if
> > > idle.
> > > >
> > > > Bug 13685 reported by Laurence Rowe, investigated in detail by Michael
> > > Paquier,
> > > > though this is not his proposed fix.
> > > > 20151016203031(dot)3019(dot)72930(at)wrigleys(dot)postgresql(dot)org
> > > >
> > > > Simple non-invasive patch to allow later backpatch to 9.4 and 9.5
> > >
> > > Uh. This is wrong.
> >
> >
> > For one it breaks cleanup with logical decoding which
> > > does *NEED* to know that nothing is happening. Although only once, not
> > > repeatedly.
> > >
> >
> > If the patch did that, I agree it would be wrong. It doesn't,
> > deliberately.
>
> It doesn't?
>
> + if (running->xcnt == 0 &&
> + nlocks == 0 &&
> + XLogArchiveTimeout > 0 &&
> + !last_snapshot_overflowed)
> + {
> + LWLockRelease(XidGenLock);
> + return InvalidXLogRecPtr;
> + }
>
> Overflowed snapshots aren't a problem for logical decoding. But we need
> to know that no old transactions are running occasionally.

For that matter, it's also important for hot standby; to deal with
FATALed transactions which didn't write an abort record. It's kinda
important to call StandbyReleaseOldLocks for those. And if a standby is
in STANDBY_SNAPSHOT_READY it's also important to see this kind of
record.

Additionally, we're now logging more WAL if archive timeout isn't
configured, which doesn't strike me as a good idea.

Andres

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Simon Riggs 2016-04-04 07:08:32 Re: pgsql: Avoid archiving XLOG_RUNNING_XACTS on idle server
Previous Message Andres Freund 2016-04-04 06:42:02 Re: pgsql: Avoid archiving XLOG_RUNNING_XACTS on idle server

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2016-04-04 06:55:05 Re: Choosing parallel_degree
Previous Message Andres Freund 2016-04-04 06:43:45 Re: Timeline following for logical slots