| From: | "Drouvot, Bertrand" <bdrouvot(at)amazon(dot)com> | 
|---|---|
| To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> | 
| Cc: | Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> | 
| Subject: | Re: [BUG] failed assertion in EnsurePortalSnapshotExists() | 
| Date: | 2021-09-29 19:53:51 | 
| Message-ID: | 4e492a2d-2441-e04a-fdcc-1866d7a8eafe@amazon.com | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-hackers | 
On 9/29/21 8:01 PM, Tom Lane wrote:
> Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> writes:
>> On 2021-Sep-29, Ranier Vilela wrote:
>>> Em qua., 29 de set. de 2021 às 08:12, Drouvot, Bertrand <bdrouvot(at)amazon(dot)com>
>>> escreveu:
>>> Duplicating functions is very bad for maintenance and bloats the code
>>> unnecessarily, IMHO.
>> Well, there are 42 calls of PushActiveSnapshot currently, and only 6 are
>> updated in the patch.  Given that six sevenths of the calls continue to
>> use the existing function and that it is less verbose than the new one,
>> that seems sufficient argument to keep it.
> Seeing that we have to back-patch this, changing the ABI of
> PushActiveSnapshot seems like a complete non-starter.
>
> The idea I'd had to avoid code duplication was to make
> PushActiveSnapshot a wrapper for the extended function:
>
> void
> PushActiveSnapshot(Snapshot snap)
> {
>      PushActiveSnapshotWithLevel(snap, GetCurrentTransactionNestLevel());
> }
Implemented into the new attached patch.
> So more like
>
>      Assert(ActiveSnapshot == NULL ||
>             snap_level >= ActiveSnapshot->as_level);
Implemented into the new attached patch.
But make check is now failing on join_hash.sql, I have been able to 
repro with:
create table bdt (a int);
begin;
savepoint a;
rollback to a;
explain select count(*) from bdt;
Which triggers a failed assertion on the new one:
TRAP: FailedAssertion("ActiveSnapshot == NULL || as_level >= 
ActiveSnapshot->as_level"
because we have as_level = 2 while ActiveSnapshot->as_level = 3.
Thanks
Bertrand
| Attachment | Content-Type | Size | 
|---|---|---|
| v2-0002-EnsurePortalSnapshotExists-failed-assertion.patch | text/plain | 6.0 KB | 
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2021-09-29 20:00:12 | Re: jsonb crash | 
| Previous Message | Tom Lane | 2021-09-29 19:36:11 | Re: Empty string in lexeme for tsvector |