Re: PATCH: Add REINDEX tag to event triggers - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: PATCH: Add REINDEX tag to event triggers
Date
Msg-id ZTtjh6UtGw9zyvX6@paquier.xyz
Whole thread Raw
In response to Re: PATCH: Add REINDEX tag to event triggers  (Jim Jones <jim.jones@uni-muenster.de>)
Responses Re: PATCH: Add REINDEX tag to event triggers
List pgsql-hackers
On Mon, Sep 04, 2023 at 08:00:52PM +0200, Jim Jones wrote:
> LGTM. It applies and builds cleanly, all tests pass and documentation also
> builds ok. The CFbot seems also much happier now :)

+    /*
+     * Open and lock the relation.  ShareLock is sufficient since we only need
+     * to prevent schema and data changes in it.  The lock level used here
+     * should match catalog's reindex_relation().
+     */
+    rel = try_table_open(relid, ShareLock);

I was eyeing at 0003, and this strikes me as incorrect.  Sure, this
matches what reindex_relation() does, but you've missed that
CONCURRENTLY takes a lighter ShareUpdateExclusiveLock, and ShareLock
conflicts with it.  See:
https://www.postgresql.org/docs/devel/explicit-locking.html

So, doesn't this disrupt a concurrent REINDEX?
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Étienne BERSAC
Date:
Subject: Re: run pgindent on a regular basis / scripted manner
Next
From: Michael Paquier
Date:
Subject: Re: Requiring recovery.signal or standby.signal when recovering with a backup_label