Re: Handle concurrent drop when doing whole database vacuum

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: cca5507 <cca5507(at)qq(dot)com>
Cc: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, surya poondla <suryapoondla4(at)gmail(dot)com>
Subject: Re: Handle concurrent drop when doing whole database vacuum
Date: 2026-06-25 06:19:57
Message-ID: ajzIjd8sb2wiIXs5@paquier.xyz
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jun 25, 2026 at 01:53:39PM +0800, cca5507 wrote:
> I think the current one is ok, so I didn't change this.

+ * Note: this function is called without holding a relation lock for database-wide
+ * VACUUM or ANALYZE, so the relation can be dropped concurrently. In that
+ * case, issue a WARNING and return false.

FWIW, even after sleeping on it, I don't think that this patch is
going in the right direction. I am pretty sure that we should just
lift the ACL check in get_all_vacuum_rels() and always require
vacuum_is_permitted_for_relation() to have the relation locked when
called. This way we would rely on one single code path for the ACL
check, even if it means holding a reference of a relation OID for
something to be processsed later. So I would revisit the choice made
in a556549d7e6d. The isolation test vacuum-conflict also seems OK
with this shortcut, after a quick test, which was the kind of patterns
this commit is after.
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kirill Reshke 2026-06-25 06:33:25 psql internals queries breaks in presence of user-defined operators
Previous Message Chao Li 2026-06-25 06:14:35 Re: psql: add tab completion for subscription wal_receiver_timeout