Re: hyrax vs. RelationBuildPartitionDesc
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
Cc: Michael Paquier <michael@paquier.xyz>,
Robert Haas <robertmhaas@gmail.com>,
Alvaro Herrera <alvherre@2ndquadrant.com>,
PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2019-04-16T17:35:25Z
Lists: pgsql-hackers
Amit Langote <Langote_Amit_f8@lab.ntt.co.jp> writes: > On 2019/04/15 2:38, Tom Lane wrote: >> To my mind there are only two trustworthy solutions to the problem of >> wanting time-extended usage of a relcache subsidiary data structure: one >> is to copy it, and the other is to reference-count it. I think that going >> over to a reference-count-based approach for many of these structures >> might well be something we should do in future, maybe even the very near >> future. In the mean time, though, I'm not really satisfied with inserting >> half-baked kluges, especially not ones that are different from our other >> half-baked kluges for similar purposes. I think that's a path to creating >> hard-to-reproduce bugs. > +1 to reference-count-based approach. > I've occasionally wondered why there is both keep_tupdesc kludge and > refcounting for table TupleDescs. I guess it's because *only* the > TupleTableSlot mechanism in the executor uses TupleDesc pinning (that is, > refcounting) and the rest of the sites depend on the shaky guarantee > provided by keep_tupdesc. The reason for that is simply that at the time we added TupleDesc refcounts, we didn't want to do the extra work of making all uses of relcache entries' tupdescs deal with refcounting; keep_tupdesc is certainly a kluge, but it works for an awful lot of callers. We'd have to go back and deal with that more honestly if we go down this path. I'm inclined to think we could still allow many call sites to not do an incr/decr-refcount dance as long as they're just fetching scalar values out of the relcache's tupdesc, and not keeping any pointer into it. However, it's hard to see how to enforce such a rule mechanically, so it might be impractically error-prone to allow that. regards, tom lane
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