Re: REINDEX SCHEMA/DATABASE/SYSTEM weak with dropped relations

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: Anastasia Lubennikova <a.lubennikova@postgrespro.ru>
Cc: Postgres hackers <pgsql-hackers@lists.postgresql.org>
Date: 2020-09-01T01:38:44Z
Lists: pgsql-hackers

Attachments

On Mon, Aug 31, 2020 at 06:10:46PM +0300, Anastasia Lubennikova wrote:
> I reviewed the patch. It does work and the code is clean and sane. It
> implements a logic that we already had in CLUSTER, so I think it was simply
> an oversight. Thank you for fixing this.

Thanks Anastasia for the review.

> I noticed that REINDEXOPT_MISSING_OK can be passed to the TOAST table
> reindex. I think it would be better to reset the flag in this
> reindex_relation() call, as we don't expect a concurrent DROP here.

Good point, and fixed by resetting the flag here if it is set.

I have added some extra comments.  There is one in
ReindexRelationConcurrently() to mention that there should be no extra
use of MISSING_OK once the list of indexes is built as session locks
are taken where needed.

Does the version attached look fine to you?  I have done one round of
indentation while on it.
--
Michael

Commits

  1. Fix thinko with definition of REINDEXOPT_MISSING_OK

  2. Improve handling of dropped relations for REINDEX DATABASE/SCHEMA/SYSTEM