From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Improve handling of dropped relations for REINDEX DATABASE/SCHEM
Date: Wed, 02 Sep 2020 00:09:40 +0000
Message-ID: <E1kDGLM-0002ke-K3@gemulon.postgresql.org> (raw)
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(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: michael@paquier.xyz
Subject: Re: pgsql: Improve handling of dropped relations for REINDEX DATABASE/SCHEM
In-Reply-To: <E1kDGLM-0002ke-K3@gemulon.postgresql.org>
References: <E1kDGLM-0002ke-K3@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox