pgsql: Fix waits of REINDEX CONCURRENTLY for indexes with predicates or

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix waits of REINDEX CONCURRENTLY for indexes with predicates or
Date: 2024-09-09 04:50:51
Message-ID: E1snWMV-000FTV-87@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix waits of REINDEX CONCURRENTLY for indexes with predicates or expressions

As introduced by f9900df5f94, a REINDEX CONCURRENTLY job done for an
index with predicates or expressions would set PROC_IN_SAFE_IC in its
MyProc->statusFlags, causing it to be ignored by other concurrent
operations.

Such concurrent index rebuilds should never be ignored, as a predicate
or an expression could call a user-defined function that accesses a
different table than the table where the index is rebuilt.

A test that uses injection points is added, backpatched down to 17.
Michail has proposed a different test, but I have added something
simpler with more coverage.

Oversight in f9900df5f949.

Author: Michail Nikolaev
Discussion: https://postgr.es/m/CANtu0oj9A3kZVduFTG0vrmGnKB+DCHgEpzOp0qAyOgmks84j0w@mail.gmail.com
Backpatch-through: 14

Branch
------
REL_16_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/edb0f6e41b09d261326c5340acad3a2cea59d718

Modified Files
--------------
src/backend/commands/indexcmds.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Amit Langote 2024-09-09 06:59:44 pgsql: SQL/JSON: Avoid initializing unnecessary ON ERROR / ON EMPTY ste
Previous Message Amit Langote 2024-09-09 04:47:27 pgsql: SQL/JSON: Avoid initializing unnecessary ON ERROR / ON EMPTY ste