pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ants Aasma <ants.aasma@eesti.ee>
To: Andres Freund <andres@anarazel.de>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Kevin Grittner <kgrittn@gmail.com>
Cc: Amit Kapila <amit.kapila16@gmail.com>
Cc: Noah Misch <noah@leadboat.com>
Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
Subject: Re: Re: [COMMITTERS] pgsql: Avoid extra locks in GetSnapshotData if old_snapshot_threshold <
Date: Mon, 2 May 2016 18:15:40 +0300
Message-ID: <CA+CSw_v4zPA0VC9ogAEyrwnAgy0XO2_j6H8oaEbyFyyS3Ot2fQ@mail.gmail.com> (raw)
In-Reply-To: <500986603.206741.1462198885924@RIA>
References: <20160416205630.puxsglckxi3sn5ec@alap3.anarazel.de>
	<CAA4eK1JihZepuTasniqrHcsha0umwjeke_ay3AckpGMH4QdJ_g@mail.gmail.com>
	<171569342.34745.1461078735421@RIA>
	<CA+CSw_tqckBCfrTgMyQOBGscM=5t7qYzBS94udGUOFWiOLeHbw@mail.gmail.com>
	<1837416819.81786.1461248181440@RIA>
	<CA+CSw_srK=BSBJhLtsPiMM8iZcFKv_0hT8Sf6X2O8VEyhDpsMg@mail.gmail.com>
	<CACjxUsNHLfy4SOcaC_uL-uNno-KzjC=nYpLoOsj9iEM2jMQNXw@mail.gmail.com>
	<CACjxUsNVtTGJ9b+bqytYMpG7sY=aN_+4z0XXEagxpqU_HYDuCg@mail.gmail.com>
	<CACjxUsPXgspNPRRwT5DoBHzPKAEaRPNtQ6Max+x5_NVSdHBCOw@mail.gmail.com>
	<CA+TgmoacXFw0VY3hzbUS6kFYUXY5PRZAmpp6PUnWVvQtRN+3nQ@mail.gmail.com>
	<500986603.206741.1462198885924@RIA>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

On Mon, May 2, 2016 at 5:21 PM, Andres Freund <andres@anarazel.de> wrote:
> On 2016-05-02 09:03:19 -0400, Robert Haas wrote:
>> On Fri, Apr 29, 2016 at 6:08 PM, Kevin Grittner <kgrittn@gmail.com> wrote:
>> > Now to continue with the performance benchmarks.  I'm pretty sure
>> > we've fixed the problems when the feature is disabled
>> > (old_snapshot_threshold = -1), and there are several suggestions
>> > for improving performance while it is on that need to be compared
>> > and benchmarked.
>>
>> If anyone thinks that the issue with the feature disabled is NOT
>> fixed, please speak up!  I'm moving the corresponding open item to
>> CLOSE_WAIT status, meaning that it will be closed if nobody shows up
>> to say that there is still an issue.
>
> Well, I don't agree that the feature is in a releaseable state. The
> datastructure is pretty much non-scalable, and maintained on the wrong
> side (every read, instead of once in writing writing xacts). There's no
> proposal actually addressing the scalability issues.

Unless I'm missing something fundamental the feature only requires
tracking an upper bound on xmin observed by snapshots between clock
ticks. The simplest way to do this would be a periodic process that
increments a clock counter (32bit counter would be plenty) and then
calculates xmin for the preceding range. With this scheme
GetSnapshotData would need two atomic fetches to get current LSN and
the timestamp. Test for old snapshot can also run completely lock free
with a single atomic fetch of threshold timestamp. The negative side
is that we need to have a process running that runs the clock ticks
and the ticks may sometimes be late. Giving something like autovacuum
launcher this task doesn't seem too bad and the consequence of falling
behind is just delayed timing out of old snapshots.

As far as I can see this approach would get rid of any scalability
issues, but it is a pretty significant change and requires 64bit
atomic reads to get rid of contention on xlog insert lock.

Regards,
Ants Aasma


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



view thread (195+ messages)  latest in thread

Message-ID: <CA+CSw_v4zPA0VC9ogAEyrwnAgy0XO2_j6H8oaEbyFyyS3Ot2fQ@mail.gmail.com>
Permalink:  ../CA+CSw_v4zPA0VC9ogAEyrwnAgy0XO2_j6H8oaEbyFyyS3Ot2fQ@mail.gmail.com/
Also on:    postgresql.org/message-id/CA+CSw_v4zPA0VC9ogAEyrwnAgy0XO2_j6H8oaEbyFyyS3Ot2fQ@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: ants.aasma@eesti.ee, andres@anarazel.de, robertmhaas@gmail.com, kgrittn@gmail.com, amit.kapila16@gmail.com, noah@leadboat.com, pgsql-hackers@postgresql.org
  Subject: Re: [COMMITTERS] pgsql: Avoid extra locks in GetSnapshotData if old_snapshot_threshold <
  In-Reply-To: <CA+CSw_v4zPA0VC9ogAEyrwnAgy0XO2_j6H8oaEbyFyyS3Ot2fQ@mail.gmail.com>
  References: <20160416205630.puxsglckxi3sn5ec@alap3.anarazel.de> <CAA4eK1JihZepuTasniqrHcsha0umwjeke_ay3AckpGMH4QdJ_g@mail.gmail.com> <171569342.34745.1461078735421@RIA> <CA+CSw_tqckBCfrTgMyQOBGscM=5t7qYzBS94udGUOFWiOLeHbw@mail.gmail.com> <1837416819.81786.1461248181440@RIA> <CA+CSw_srK=BSBJhLtsPiMM8iZcFKv_0hT8Sf6X2O8VEyhDpsMg@mail.gmail.com> <CACjxUsNHLfy4SOcaC_uL-uNno-KzjC=nYpLoOsj9iEM2jMQNXw@mail.gmail.com> <CACjxUsNVtTGJ9b+bqytYMpG7sY=aN_+4z0XXEagxpqU_HYDuCg@mail.gmail.com> <CACjxUsPXgspNPRRwT5DoBHzPKAEaRPNtQ6Max+x5_NVSdHBCOw@mail.gmail.com> <CA+TgmoacXFw0VY3hzbUS6kFYUXY5PRZAmpp6PUnWVvQtRN+3nQ@mail.gmail.com> <500986603.206741.1462198885924@RIA> <CA+CSw_v4zPA0VC9ogAEyrwnAgy0XO2_j6H8oaEbyFyyS3Ot2fQ@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox