pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix handling of pg_class.relispartition at swap phase in REINDEX
Date: Tue, 29 Oct 2019 02:10:34 +0000
Message-ID: <E1iPGxu-0006Qy-H0@gemulon.postgresql.org> (raw)

Fix handling of pg_class.relispartition at swap phase in REINDEX CONCURRENTLY

When cancelling REINDEX CONCURRENTLY after swapping the old and new
indexes (for example interruption at step 5), the old index remains
around and is marked as invalid.  The old index should also be manually
droppable to clean up the parent relation from any invalid indexes still
remaining.  For a partition index reindexed, pg_class.relispartition was
not getting updated, causing the index to not be droppable as DROP INDEX
would look for dependencies in a partition tree, which do not exist
anymore after the swap phase is done.

The fix here is simple: when swapping the old and new indexes, make sure
that pg_class.relispartition is correctly switched, similarly to what is
done for the index name.

Reported-by: Justin Pryzby
Author: Michael Paquier
Discussion: https://postgr.es/m/20191015164047.GA22729@telsasoft.com
Backpatch-through: 12

Branch
------
REL_12_STABLE

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

Modified Files
--------------
src/backend/catalog/index.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)



view thread (2+ messages)

Message-ID: <E1iPGxu-0006Qy-H0@gemulon.postgresql.org>
Permalink:  ../E1iPGxu-0006Qy-H0@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1iPGxu-0006Qy-H0@gemulon.postgresql.org

 · 

reply

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: Fix handling of pg_class.relispartition at swap phase in REINDEX
  In-Reply-To: <E1iPGxu-0006Qy-H0@gemulon.postgresql.org>
  References: <E1iPGxu-0006Qy-H0@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