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: Reset indisreplident for an invalid index in DROP INDEX CONCURRE
Date: Sun, 30 Aug 2020 05:41:36 +0000
Message-ID: <E1kCG5w-0002NA-J0@gemulon.postgresql.org> (raw)

Reset indisreplident for an invalid index in DROP INDEX CONCURRENTLY

A failure when dropping concurrently an index used in a replica identity
could leave in pg_index an index marked as !indisvalid and
indisreplident.  Reindexing this index would switch back indisvalid to
true, and if the replica identity of the parent relation was switched to
use a different index, it would be possible to finish with more than one
index marked as indisreplident.  If that were to happen, this could mess
up with the relation cache as an incorrect index could be used for the
replica identity.

Indexes marked as invalid are discarded as candidates for the replica
identity, as of RelationGetIndexList(), so similarly to what is done
with indisclustered, resetting indisreplident when the index is marked
as invalid keeps things consistent.  REINDEX CONCURRENTLY's swapping
already resets the flag for the old index, while the new index inherits
the value of the old index to-be-dropped, so only DROP INDEX was an
issue.

Even if this is a bug, the sequence able to reproduce a problem requires
a failure while running DROP INDEX CONCURRENTLY, something unlikely
going to happen in the field, so no backpatch is done.

Author: Michael Paquier
Reviewed-by: Dmitry Dolgov
Discussion: https://postgr.es/m/20200827025721.GN2017@paquier.xyz

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/9511fb37ac78c77736e5483118265f7e83cd9f3c

Modified Files
--------------
src/backend/catalog/index.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)



Message-ID: <E1kCG5w-0002NA-J0@gemulon.postgresql.org>
Permalink:  ../E1kCG5w-0002NA-J0@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1kCG5w-0002NA-J0@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: Reset indisreplident for an invalid index in DROP INDEX CONCURRE
  In-Reply-To: <E1kCG5w-0002NA-J0@gemulon.postgresql.org>
  References: <E1kCG5w-0002NA-J0@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