Re: DROP OWNED CASCADE vs Temp tables

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Mithun Cy <mithun(dot)cy(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: DROP OWNED CASCADE vs Temp tables
Date: 2020-01-13 22:45:06
Message-ID: 20200113224506.GA5833@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On 2020-Jan-07, Mithun Cy wrote:

> I have a test where a user creates a temp table and then disconnect,
> concurrently we try to do DROP OWNED BY CASCADE on the same user. Seems
> this causes race condition between temptable deletion during disconnection
> (@RemoveTempRelations(myTempNamespace)) and DROP OWNED BY CASCADE operation
> which will try to remove same temp table when they find them as part of
> pg_shdepend.

Cute.

This seems fiddly to handle better; maybe you'd have to have a new
PERFORM_DELETION_* flag that says to ignore "missing" objects; so when
you go from shdepDropOwned, you pass that flag all the way down to
doDeletion(), so the objtype-specific function is called with
"missing_ok", and ignore if the object has already gone away. That's
tedious because none of the Remove* functions have the concept of
missing_ok.

--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Paquier 2020-01-14 00:19:38 Re: DROP OWNED CASCADE vs Temp tables
Previous Message Michael Paquier 2020-01-13 22:33:41 Re: BUG #16122: segfault pg_detoast_datum (datum=0x0) at fmgr.c:1833 numrange query

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2020-01-13 22:53:20 Re: Building infrastructure for B-Tree deduplication that recognizes when opclass equality is also equivalence
Previous Message Michael Paquier 2020-01-13 22:23:19 Re: isTempNamespaceInUse() is incorrect with its handling of MyBackendId