Re: Incorrect visibility test function assigned to snapshot

From: Antonin Houska <ah(at)cybertec(dot)at>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Incorrect visibility test function assigned to snapshot
Date: 2018-05-30 14:00:44
Message-ID: 28524.1527688844@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andres Freund <andres(at)anarazel(dot)de> wrote:

> On May 30, 2018 9:45:32 AM EDT, Antonin Houska <ah(at)cybertec(dot)at> wrote:
> >Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> wrote:
> >
> >> On 2018-May-30, Antonin Houska wrote:
> >>
> >> > In the header comment, SnapBuildInitialSnapshot() claims to set
> >> > snapshot->satisfies to the HeapTupleSatisfiesMVCC test function,
> >and indeed it
> >> > converts the "xid" array to match its semantics (i.e. the xid items
> >eventually
> >> > represent running transactions as opposed to the committed ones).
> >However the
> >> > test function remains HeapTupleSatisfiesHistoricMVCC as set by
> >> > SnapBuildBuildSnapshot().
> >>
> >> Interesting. While this sounds like an oversight that should have
> >> horrible consequences, it's seems not to because the current callers
> >> don't seem to care about the ->satisfies function. Are you able to
> >come
> >> up with some scenario in which it causes an actual problem?
> >
> >Right, the current callers in the core do not seem to use that
> >function. I hit
> >the issue when doing and testing some changes in an extension
> >(pg_squeeze).
>
> What is that extension doing with that snapshot?

It fetches data from a table in order to insert them into a new table, to
eliminate bloat. Something like pg_repack, but it uses logical decoding
instead of triggers to capture concurrent data changes.

--
Antonin Houska
Cybertec Schönig & Schönig GmbH
Gröhrmühlgasse 26, A-2700 Wiener Neustadt
Web: https://www.cybertec-postgresql.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Gustafsson 2018-05-30 14:37:27 Re: Microoptimization of Bitmapset usage in postgres_fdw
Previous Message Andres Freund 2018-05-30 13:49:44 Re: Incorrect visibility test function assigned to snapshot