pgsql: Improve handling of dropped relations for REINDEX DATABASE/SCHEM

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема pgsql: Improve handling of dropped relations for REINDEX DATABASE/SCHEM
Дата
Msg-id E1kDGLM-0002ke-K3@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Improve handling of dropped relations for REINDEX DATABASE/SCHEMA/SYSTEM

When multiple relations are reindexed, a scan of pg_class is done first
to build the list of relations to work on.  However the REINDEX logic
has never checked if a relation listed still exists when beginning the
work on it, causing for example sudden cache lookup failures.

This commit adds safeguards against dropped relations for REINDEX,
similarly to VACUUM or CLUSTER where we try to open the relation,
ignoring it if it is missing.  A new option is added to the REINDEX
routines to control if a missed relation is OK to ignore or not.

An isolation test, based on REINDEX SCHEMA, is added for the concurrent
and non-concurrent cases.

Author: Michael Paquier
Reviewed-by: Anastasia Lubennikova
Discussion: https://postgr.es/m/20200813043805.GE11663@paquier.xyz

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/1d65416661bbb0b165865a521ce038ffb61b12ad

Modified Files
--------------
src/backend/access/table/table.c               | 34 ++++++++++++++
src/backend/catalog/index.c                    | 34 ++++++++++++--
src/backend/commands/indexcmds.c               | 63 ++++++++++++++++++++++++--
src/include/access/table.h                     |  1 +
src/include/nodes/parsenodes.h                 |  1 +
src/test/isolation/expected/reindex-schema.out | 17 +++++++
src/test/isolation/isolation_schedule          |  1 +
src/test/isolation/specs/reindex-schema.spec   | 32 +++++++++++++
8 files changed, 174 insertions(+), 9 deletions(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: pgsql: Improve test coverage of ginvacuum.c.
Следующее
От: Alvaro Herrera
Дата:
Сообщение: pgsql: Fix typo in comment