pgsql: Rework handling of invalid indexes with REINDEX CONCURRENTLY - Mailing list pgsql-committers

From Michael Paquier
Subject pgsql: Rework handling of invalid indexes with REINDEX CONCURRENTLY
Date
Msg-id E1hGYdo-0000OE-AN@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Rework handling of invalid indexes with REINDEX CONCURRENTLY

Per discussion with others, allowing REINDEX INDEX CONCURRENTLY to work
for invalid indexes when working directly on them can have a lot of
value to unlock situations with invalid indexes without having to use a
dance involving DROP INDEX followed by an extra CREATE INDEX
CONCURRENTLY (which would not work for indexes with constraint
dependency anyway).  This also does not create extra bloat on the
relation involved as this works on individual indexes, so let's enable
it.

Note that REINDEX TABLE CONCURRENTLY still bypasses invalid indexes as
we don't want to bloat the number of indexes defined on a relation in
the event of multiple and successive failures of REINDEX CONCURRENTLY.

More regression tests are added to cover those behaviors, using an
invalid index created with CREATE INDEX CONCURRENTLY.

Reported-by: Dagfinn Ilmari Mannsåker, Álvaro Herrera
Author: Michael Paquier
Reviewed-by: Peter Eisentraut, Dagfinn Ilmari Mannsåker
Discussion: https://postgr.es/m/20190411134947.GA22043@alvherre.pgsql

Branch
------
master

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

Modified Files
--------------
doc/src/sgml/ref/create_index.sgml         |  6 ++--
doc/src/sgml/ref/reindex.sgml              | 11 ++++---
src/backend/commands/indexcmds.c           | 29 ++++--------------
src/test/regress/expected/create_index.out | 47 ++++++++++++++++++++++++++++++
src/test/regress/sql/create_index.sql      | 20 +++++++++++++
5 files changed, 80 insertions(+), 33 deletions(-)


pgsql-committers by date:

Previous
From: Fujii Masao
Date:
Subject: pgsql: Add index terms for reloptions in documentation.
Next
From: Michael Paquier
Date:
Subject: pgsql: Simplify some ERROR paths clearing wait events and transientfil