Re: TRAP: FailedAssertion("HaveRegisteredOrActiveSnapshot()", File: "toast_internals.c", Line: 670, PID: 19403)

Kyotaro Horiguchi <horikyota.ntt@gmail.com>

From: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
To: er@xs4all.nl
Cc: boekewurm+postgres@gmail.com, pgsql-hackers@lists.postgresql.org
Date: 2022-03-30T08:58:24Z
Lists: pgsql-hackers

Attachments

At Wed, 30 Mar 2022 11:46:13 +0900 (JST), Kyotaro Horiguchi <horikyota.ntt@gmail.com> wrote in 
> But, in the first place the *fix* has been found to be wrong.  I'm
> going to search for the right fix..

FETCH uses the snapshot at DECLARE. So anyhow I needed to set the
queryDesk's snapshot used in PortalRunSelect to the FETCH's portal's
holdSnapshot.  What I did in this version is:

1. Add a new member "snapshot" to the type DestReceiver.

2. In PortalRunSelect, set the DECLARE'd query's snapshot to the
  member iff the dest is tupelstore and the active snapshot is not
  set.

3. In FillPortalStore, copy the snapshot to the portal's holdSnapshot.

4. RunFromStore uses holdSnapshot if any.

I'm not still confident on this, but it should be better than the v1.

regards.

-- 
Kyotaro Horiguchi
NTT Open Source Software Center

Commits

  1. Fix incorrect logic in HaveRegisteredOrActiveSnapshot().

  2. Fix temporary object cleanup failing due to toast access without snapshot.

  3. Account for catalog snapshot in PGXACT->xmin updates.