Re: ATTACH/DETACH PARTITION CONCURRENTLY
Robert Haas <robertmhaas@gmail.com>
From: Robert Haas <robertmhaas@gmail.com>
To: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2019-02-28T20:27:59Z
Lists: pgsql-hackers
Attachments
- v4-0004-Reduce-the-lock-level-required-to-attach-a-partit.patch (application/octet-stream) patch v4-0004
- v4-0002-Ensure-that-repeated-PartitionDesc-lookups-return.patch (application/octet-stream) patch v4-0002
- v4-0001-Teach-RelationBuildPartitionDesc-to-cope-with-con.patch (application/octet-stream) patch v4-0001
- v4-0003-Teach-runtime-partition-pruning-to-cope-with-conc.patch (application/octet-stream) patch v4-0003
On Tue, Feb 26, 2019 at 5:10 PM Robert Haas <robertmhaas@gmail.com> wrote: > Aside from these problems, I think I have spotted a subtle problem in > 0001. I'll think about that some more and post another update. 0001 turned out to be guarding against the wrong problem. It supposed that if we didn't get a coherent view of the system catalogs due to concurrent DDL, we could just AcceptInvalidationMessages() and retry. But that turns out to be wrong, because there's a (very) narrow window after a process removes itself from the ProcArray and before it sends invalidation messages. It wasn't difficult to engineer an alternative solution that works, but unfortunately it's only good enough to handle the ATTACH case, so this is another thing that will need more thought for concurrent DETACH. Anyway, the updated 0001 contains that code and some explanatory comments. The rest of the series is substantially unchanged. I'm not currently aware of any remaining correctness issues with this code, although certainly there may be some. There has been a certain dearth of volunteers to review any of this. I do plan to poke at it a bit to see whether it has any significant performance impact, but not today. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company
Commits
-
Allow ATTACH PARTITION with only ShareUpdateExclusiveLock.
- 898e5e3290a7 12.0 landed
-
Change lock acquisition order in expand_inherited_rtentry.
- f4b6341d5fcb 12.0 landed
-
Move code for managing PartitionDescs into a new file, partdesc.c
- 1bb5e7821810 12.0 landed
-
Remove more redundant relation locking during executor startup.
- f2343653f5b2 12.0 cited
-
Add assertions that we hold some relevant lock during relation open.
- b04aeb0a053e 12.0 cited
-
Try to acquire relation locks in RangeVarGetRelid.
- 4240e429d0c2 9.2.0 cited