On Thu, 22 Sept 2022 at 15:16, Alvaro Herrera <alvherre@alvh.no-ip.org> wrote:
>
> On 2022-Sep-22, Simon Riggs wrote:
>
> > On Mon, 19 Sept 2022 at 00:16, Greg Stark <stark@mit.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/