Re: Patch to avoid orphaned dependencies

From: Ronan Dunklau <ronan(dot)dunklau(at)aiven(dot)io>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Gilles Darold <gilles(at)darold(dot)net>, "Nasby, Jim" <nasbyj(at)amazon(dot)com>, "Bossart, Nathan" <bossartn(at)amazon(dot)com>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, "Drouvot, Bertrand" <bdrouvot(at)amazon(dot)com>
Subject: Re: Patch to avoid orphaned dependencies
Date: 2021-09-17 08:09:00
Message-ID: 125530172.cco2f6atf3@aivenronan
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello Bertrand,

Le mardi 4 mai 2021, 11:55:43 CEST Drouvot, Bertrand a écrit :
>
> Implementation overview:
>
> * A new catalog snapshot is added: DirtyCatalogSnapshot.
> * This catalog snapshot is a dirty one to be able to look for
> in-flight dependencies.
> * Its usage is controlled by a new UseDirtyCatalogSnapshot variable.
> * Any time this variable is being set to true, then the next call to
> GetNonHistoricCatalogSnapshot() is returning the dirty snapshot.
> * This snapshot is being used to check for in-flight dependencies and
> also to get the objects description to generate the error messages.
>

I quickly tested the patch, it behaves as advertised, and passes tests.

Isolation tests should be added to demonstrate the issues it is solving.

However, I am bit wary of this behaviour of setting the DirtyCatalogSnapshot
global variable which is then reset after each snapshot acquisition: I'm
having trouble understanding all the implications of that, if it would be
possible to introduce an unforeseen snapshot before the one we actually want
to be dirty.

I don't want to derail this thread, but couldn't predicate locks on the
pg_depend index pages corresponding to the dropped object / referenced objects
work as a different approach ? I'm not familiar enough with them so maybe there
is some fundamental misunderstanding on my end.

--
Ronan Dunklau

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message gkokolatos 2021-09-17 08:12:42 Re: Teach pg_receivewal to use lz4 compression
Previous Message Michael Paquier 2021-09-17 07:39:41 Re: Teach pg_receivewal to use lz4 compression