Re: Missing dependency tracking for TableFunc nodes - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Missing dependency tracking for TableFunc nodes
Date
Msg-id 14155.1573767414@sss.pgh.pa.us
Whole thread Raw
In response to Re: Missing dependency tracking for TableFunc nodes  (Tomas Vondra <tomas.vondra@2ndquadrant.com>)
Responses Re: Missing dependency tracking for TableFunc nodes  (Tomas Vondra <tomas.vondra@2ndquadrant.com>)
List pgsql-hackers
Tomas Vondra <tomas.vondra@2ndquadrant.com> writes:
> On Wed, Nov 13, 2019 at 08:37:59PM -0500, Tom Lane wrote:
>> I concur with Tomas' suspicion that this must be a race condition
>> during DROP STATISTICS.  If we're going to allow people to do that
>> separately from dropping the table(s), there has to be some kind of
>> locking around it, and it sounds like there's not :-(

> I think the right thing to do is simply acquire AE lock on the relation
> in RemoveStatisticsById, per the attached patch. It's possible we'll
> need to do something more complicated once join stats are added, but
> for now this should be enough (and backpatchable).

Hm.  No, it's not enough, unless you add more logic to deal with the
possibility that the stats object is gone by the time you have the
table lock.  Consider e.g. two concurrent DROP STATISTICS commands,
or a statistics drop that's cascading from something like a drop
of a relevant function and so has no earlier table lock.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Tomas Vondra
Date:
Subject: Re: Missing dependency tracking for TableFunc nodes
Next
From: Tomas Vondra
Date:
Subject: Re: Using multiple extended statistics for estimates