Re: Pruning never visible changes

From: Simon Riggs <simon(dot)riggs(at)enterprisedb(dot)com>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: Greg Stark <stark(at)mit(dot)edu>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Pruning never visible changes
Date: 2022-09-22 20:04:35
Message-ID: CANbhV-HGFZ0+2wm2MzxAxRWDbbxTfPd5eA8-84unSH9Ugw2rQA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, 22 Sept 2022 at 15:16, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> wrote:
>
> On 2022-Sep-22, Simon Riggs wrote:
>
> > On Mon, 19 Sept 2022 at 00:16, Greg Stark <stark(at)mit(dot)edu> wrote:
>
> > > VACUUM was willing to remove a committed-dead tuple immediately if it was
> > > deleted by the same transaction that inserted it. The idea is that such a
> > > tuple could never have been visible to any other transaction, so we don't
> > > need to keep it around to satisfy MVCC snapshots. However, there was
> > > already an exception for tuples that are part of an update chain, and this
> > > exception created a problem: we might remove TOAST tuples (which are never
> > > part of an update chain) while their parent tuple stayed around (if it was
> > > part of an update chain). This didn't pose a problem for most things,
> > > since the parent tuple is indeed dead: no snapshot will ever consider it
> > > visible. But MVCC-safe CLUSTER had a problem, since it will try to copy
> > > RECENTLY_DEAD tuples to the new table. It then has to copy their TOAST
> > > data too, and would fail if VACUUM had already removed the toast tuples.
>
> > Good research Greg, thank you. Only took 10 years for me to notice it
> > was gone ;-)
>
> But this begs the question: is the proposed change safe, given that
> ancient consideration? I don't think TOAST issues have been mentioned
> in this thread so far, so I wonder if there is a test case that verifies
> that this problem doesn't occur for some reason.

Oh, completely agreed.

I will submit a modified patch that adds a test case and just a
comment to explain why we can't remove such rows.

--
Simon Riggs http://www.EnterpriseDB.com/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Nathan Bossart 2022-09-22 20:05:33 Re: [RFC] building postgres with meson - v13
Previous Message Nathan Bossart 2022-09-22 18:46:13 Re: archive modules