Re: Index drops during phase 1 of REINDEX CONCURRENTLY

From: Ayush Tiwari <ayushtiwari(dot)slg01(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Index drops during phase 1 of REINDEX CONCURRENTLY
Date: 2026-11-14 05:42:09
Message-ID: CAJTYsWWYAaODzPbc84TRGAxmKzL6UHtP-REBBKG-qma-f7=kuA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Sat, 14 Nov 2026 at 06:02, Michael Paquier <michael(at)paquier(dot)xyz> wrote:
>
> Hi all,
>
> Some of the feedback I got after f24a08ec13eb involved the fact that
> indexes could also be dropped during the phase 1 of REINDEX
> CONCURRENTLY when the expressions or predicates are evaluated. The
> damage is limited to cache lookup failures or assertion hits during
> phase 2, thanks to the protections that f24a08ec13eb has added.

Yea, I can see both here without the fix. Your test fails with "could not
open relation with OID", and doing a REINDEX on the _ccnew index from the
function hits the ii_ReadyForInserts assert.

> Anyway, it would be nice to fix this issue. Attached is a patch
> addressing the problem with a test, for a backpatch down to v15.
>
> Thoughts or objections?

The patch looks good to me, some minor comment nits:

- "then close relations" in the lockrelid comment isn't true anymore, and
parentRelationIds there is heapRelationIds now?

- IIUC ReindexUnpinRelations() isn't only closing relations from
ReindexPinRelations() anymore too..

Regards,
Ayush

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Xuneng Zhou 2026-11-14 05:52:59 Re: test: avoid redundant standby catchup in 049_wait_for_lsn
Previous Message Xiaoxuan Li 2026-11-14 03:44:17 auto_explain crashes on EXPLAIN (BUFFERS) of an index scan (19, master)