From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> |
Cc: | Mithun Cy <mithun(dot)cy(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: DROP OWNED CASCADE vs Temp tables |
Date: | 2020-04-06 19:08:49 |
Message-ID: | 3019.1586200129@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs pgsql-hackers |
Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> writes:
> On 2020-Jan-14, Alvaro Herrera wrote:
>> Hmm, it seems to be doing it differently. Maybe it should be acquiring
>> locks on all objects in that nested loop and verified them for
>> existence, so that when it calls performMultipleDeletions the objects
>> are already locked, as you say.
> Yeah, this solves the reported bug.
I looked this over and think it should be fine. There will be cases
where we get a deadlock error, but such risks existed anyway, since
we'd have acquired all the same locks later in the process.
> This is not a 100% solution: there's the cases when the user is removed
> from an ACL and from a policy, and those deletions are done directly
> instead of accumulating to the end for a mass deletion.
Let's worry about that when and if we get field complaints.
> I had to export AcquireDeletionLock (previously a static in
> dependency.c). I wonder if I should export ReleaseDeletionLock too, for
> symmetry.
Hmmm ... there is an argument for doing ReleaseDeletionLock in the code
paths where you discover that the object's been deleted. Holding a lock
on a no-longer-existent object OID should be harmless from a deadlock
standpoint; but it does represent useless consumption of a shared lock
table entry, and that's a resource this operation could already burn
with abandon.
Also, if we're exporting these, it's worth expending a bit more
effort on their header comments. In particular AcquireDeletionLock
should describe its flags argument; perhaps along the lines of
"Accepts the same flags as performDeletion (though currently only
PERFORM_DELETION_CONCURRENTLY does anything)".
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Kyotaro Horiguchi | 2020-04-07 01:29:09 | Re: Don't try fetching future segment of a TLI. |
Previous Message | David Steele | 2020-04-06 19:04:07 | Re: Don't try fetching future segment of a TLI. |
From | Date | Subject | |
---|---|---|---|
Next Message | Grigory Smolkin | 2020-04-06 19:23:55 | Re: archive recovery fetching wrong segments |
Previous Message | David Steele | 2020-04-06 19:04:07 | Re: Don't try fetching future segment of a TLI. |