Re: BUG #18127: Assertion HaveRegisteredOrActiveSnapshot failed on REINDEX CONCURRENTLY when blocksize=1

From: Andres Freund <andres(at)anarazel(dot)de>
To: exclusion(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18127: Assertion HaveRegisteredOrActiveSnapshot failed on REINDEX CONCURRENTLY when blocksize=1
Date: 2023-09-28 16:25:19
Message-ID: 20230928162519.43eg6m6g2axqqz5e@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi,

On 2023-09-21 11:00:01 +0000, PG Bug reporting form wrote:
> A server compiled --with-blocksize=1 produces an assertion failure on
> `make check`. More specifically, the failure triggered on a query like:
> CREATE TABLE concur_reindex_tab (c1 int PRIMARY KEY);
> CREATE TABLE concur_reindex_tab2 (c1 int REFERENCES concur_reindex_tab);
> REINDEX INDEX CONCURRENTLY concur_reindex_tab_pkey;

> I think that the blocksize matters here just because it allows to reach
> toast_delete_datum() inside index_concurrently_swap(). Perhaps the same
> effect could be seen with the default block size, but with larger tuples
> in pg_constraint (I haven't tried to construct such tuples yet).

It seems we ought to move some assertions further up the call stacks, so that
they're hit independent of whether we actually end up toasting or
not. Otherwise it's too hard to find these problems.

Seems like we ought to have assertions in places like pg_detoast_datum(),
heap_insert(), heap_update(), heap_delete()? They all can lead to needing
toasting.

It's possible that there are some bootstrap cases or such where it's ok that
we don't have a snapshot, and that we need to weaken the assertions for that,
but that'd be ok.

> This issue is not the same as [1], because in this case I really see no
> registered or active snapshots.

Yea, it indeed looks like a real issue.

Greetings,

Andres Freund

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Andres Freund 2023-09-28 16:31:52 Re: BUG #18127: Assertion HaveRegisteredOrActiveSnapshot failed on REINDEX CONCURRENTLY when blocksize=1
Previous Message Tom Lane 2023-09-28 15:57:36 Re: BUG #18138: Using limit on VALUES causes type conversion to fail.