Re: Avoid orphaned objects dependencies, take 3

From: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Alexander Lakhin <exclusion(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: Avoid orphaned objects dependencies, take 3
Date: 2024-08-19 15:35:14
Message-ID: ZsNmMhx/rLb0r5iS@ip-10-97-1-34.eu-west-3.compute.internal
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Wed, Jul 10, 2024 at 07:31:06AM +0000, Bertrand Drouvot wrote:
> So, to sum up:
>
> A. Locking is now done exclusively with LockNotPinnedObject(Oid classid, Oid objid)
> so that it's now always clear what object we want to acquire a lock for. It means
> we are not manipulating directly an object address or a list of objects address
> as it was the case when the locking was done "directly" within the dependency code.
>
> B. A special case is done for objects that belong to the RelationRelationId class.
> For those, we should be in one of the two following cases that would already
> prevent the relation to be dropped:
>
> 1. The relation is already locked (could be an existing relation or a relation
> that we are creating).
>
> 2. The relation is protected indirectly (i.e an index protected by a lock on
> its table, a table protected by a lock on a function that depends the table...)
>
> To avoid any risks for the RelationRelationId class case, we acquire a lock if
> there is none. That may add unnecessary lock for 2. but that seems worth it.
>

Please find attached v16, mandatory rebase due to 80ffcb8427.

Regards,

--
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com

Attachment Content-Type Size
v16-0001-Avoid-orphaned-objects-dependencies.patch text/x-diff 113.5 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Ilia Evdokimov 2024-08-19 15:48:19 Re: Remove redundant NULL check in clause_selectivity_ext() function
Previous Message Ilia Evdokimov 2024-08-19 15:30:15 Re: Add support for (Var op Var) clause in extended MCV statistics