Re: [BUG] failed assertion in EnsurePortalSnapshotExists()

Drouvot, Bertrand <bdrouvot@amazon.com>

From: "Drouvot, Bertrand" <bdrouvot@amazon.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2021-09-28T04:24:42Z
Lists: pgsql-hackers
Hi,

On 9/27/21 9:44 PM, Tom Lane wrote:
> "Drouvot, Bertrand" <bdrouvot@amazon.com> writes:
>> I recently observed a failed assertion in EnsurePortalSnapshotExists().
> Hmm, interesting.
Thanks for looking at it!
>   If I take out the "update bdt2" step, so that the
> exception clause is just COMMIT, then I get something different:
>
> ERROR:  portal snapshots (1) did not account for all active snapshots (0)
> CONTEXT:  PL/pgSQL function inline_code_block line 8 at COMMIT

FWIW, I just gave it a try and it looks like this is also "fixed" by the 
proposed patch.

Does it make sense (as it is currently) to set the ActiveSnapshot to 
NULL and not ensuring the same is done for ActivePortal->portalSnapshot?

Or does it mean we should not reach a state where we set ActiveSnapshot 
to NULL while ActivePortal->portalSnapshot is not already NULL?

Thanks

Bertrand




Commits

  1. Fix Portal snapshot tracking to handle subtransactions properly.