Re: hyrax vs. RelationBuildPartitionDesc
Amit Langote <langote_amit_f8@lab.ntt.co.jp>
From: Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
To: Tom Lane <tgl@sss.pgh.pa.us>, Robert Haas <robertmhaas@gmail.com>
Cc: Alvaro Herrera <alvherre@2ndquadrant.com>,
PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2019-03-14T01:40:31Z
Lists: pgsql-hackers
Attachments
- rd_partkeycxt-HEAD.patch (text/plain) patch
- rd_partkeycxt-pg10.patch (text/plain) patch
- rd_partkeycxt-pg11.patch (text/plain) patch
On 2019/03/14 5:18, Tom Lane wrote: > Robert Haas <robertmhaas@gmail.com> writes: >> On Wed, Mar 13, 2019 at 3:14 PM Tom Lane <tgl@sss.pgh.pa.us> wrote: >>> Meanwhile, who's going to take point on cleaning up rd_partcheck? >>> I don't really understand this code well enough to know whether that >>> can share one of the existing partitioning-related sub-contexts. > >> To your question, I think it probably can't share a context. Briefly, >> rd_partkey can't change ever, except that when a partitioned relation >> is in the process of being created it is briefly NULL; once it obtains >> a value, that value cannot be changed. If you want to range-partition >> a list-partitioned table or something like that, you have to drop the >> table and create a new one. I think that's a perfectly acceptable >> permanent limitation and I have no urge whatever to change it. >> rd_partdesc changes when you attach or detach a child partition. >> rd_partcheck is the reverse: it changes when you attach or detach this >> partition to or from a parent. > > Got it. Yeah, it seems like the clearest and least bug-prone solution > is for those to be in three separate sub-contexts. The only reason > I was trying to avoid that was the angle of how to back-patch into 11. > However, we can just add the additional context pointer field at the > end of the Relation struct in v11, and that should be good enough to > avoid ABI problems. Agree that rd_partcheck needs its own context as you have complained in the past [1]. I think we'll need to back-patch this fix to PG 10 as well. I've attached patches for all 3 branches. Thanks, Amit [1] https://www.postgresql.org/message-id/22236.1523374067%40sss.pgh.pa.us
Commits
-
Load relcache entries' partitioning data on-demand, not immediately.
- 5b9312378e2f 13.0 landed
-
Prevent memory leaks associated with relcache rd_partcheck structures.
- d4c50b4b1f86 10.8 landed
- 5f1433ac5e7f 12.0 landed
- 089e4d405d0f 11.3 landed
-
Don't copy PartitionBoundInfo in set_relation_partition_info.
- c8151e642368 12.0 landed
-
Further reduce memory footprint of CLOBBER_CACHE_ALWAYS testing.
- d3f48dfae42f 12.0 landed
-
Fix some oversights in commit 2455ab488.
- de570047993b 12.0 landed
-
Defend against leaks into RelationBuildPartitionDesc.
- 2455ab48844c 12.0 landed
-
Allow ATTACH PARTITION with only ShareUpdateExclusiveLock.
- 898e5e3290a7 12.0 cited