model-writtenrun 9392 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
Mar - Jun 2019 ยท 20 entries
- Robert Haas opened the thread after Amit Kapila highlighted hyrax failures, traced excessive CLOBBER_CACHE_ALWAYS memory usage to repeated RelationBuildPartitionDesc allocations, and proposed reclaiming temporary data with a dedicated context in #1.
- Alvaro Herrera proposed separating temporary and permanent allocations to avoid copying, but Robert and Tom Lane emphasized the fragility of controlling allocations throughout partition_bounds_create and favored the simpler immediate fix in #2, #10, #12, and #13.
- Tom independently found that rd_partcheck cleanup freed only its top-level list, and Robert explained why partition keys, descriptors, and constraints have different lifetimes; they settled on a separate constraint context in #6, #16, and #17.
- The discussion also considered contexts for whole relcache entries and finer cache accounting, with Andres Freund raising overhead concerns, but those broader changes remained future work in #19, #21, and #22.
- Amit Langote supplied the separate rd_partcheck-context fix for the development branch and PostgreSQL 10/11 in #23.
- Robert committed the original temporary-context patch #1 unchanged as 2455ab4884, explaining in #24 that he had not backpatched it because the older code differed and hyrax's older branch was not failing.
- Tom's instrumented testing found that partition_bounds_create and get_rel_relkind still ran in inappropriate contexts; his diagnosis in #27 produced de57004799, which corrected those calls, simplified control flow, and reduced descriptor-context allocation size.
- The same investigation exposed temporary leaks in other RelationBuildDesc helpers, so Tom moved reclamation up to RelationBuildDesc in d3f48dfae4; despite Heikki Linnakangas's preference for consistent behavior, the policy settled on enabling it by default only in clobber-cache builds with a compile-time override in #28, #31, and #32.
- Tom explained that PartitionDirectory pins caused many more relcache rebuilds during planning and demonstrated accumulating old descriptor contexts with repeated ATTACH/DETACH operations in #33 and #35; Robert proposed reclaiming old contexts when the relation reference count reached zero in #36.
- The related optimization c8151e6423 removed redundant copying in set_relation_partition_info, but its commit message identifies an extraction from Amit's larger series in thread #39277, rather than an attachment in this thread.
- When discussion resumed in April, Amit distinguished the older constraint-expression leak from the new descriptor-retention problem, while Tom emphasized that their fixes and release status were separate in #43 and #45.
- Tom revised Amit's constraint-context patch to cache empty results correctly and add assertions and documentation in #46, and Amit supplied ABI-preserving backports in #47.
- Tom explained that rd_partcheck needs no pointer-preservation logic because callers receive copies, and that a default-only partition can legitimately have no constraints in #48; the revised development patch landed as 5f1433ac5e with only one comment adjustment.
- For descriptor retention, Tom argued that relation locks and pins alone do not guarantee subsidiary pointer stability, then posted a copying-based PartitionDirectory implementation and a partition_bounds_copy allocation optimization in #50 and #51.
- Robert opposed the measured performance loss, and Amit's tests with both populated indexed tables and empty tables confirmed substantial degradation at large partition counts in #57 and #58; the copying proposal was not adopted.
- Robert summarized the original OOM issue as fixed and advocated a narrower old-context cleanup change in #61, while Tom's additional testing suggested meaningful retention required many DDL operations within one transaction and favored deferring redesign beyond PostgreSQL 12 in #63.
- After Amul Sul reproduced the leak while attaching many partitions in one transaction, Robert posted rd_pdoldcxt-based cleanup in #64, reporting that Amul had tested it successfully.
- Amit found that repeated invalidations could destroy a descriptor still used by planning in #65, then supplied the context-chaining correction #66; Robert acknowledged the flaw and accepted the correction in #68.
- At the thread's end, the June cleanup proposal remained uncommitted: Tom objected to its invariants and hot-path costs, Robert defended its more predictable cleanup, and Tom favored reference counting across large relcache substructures rather than only partition descriptors in #69, #70, and #71.
- The later December commit 5b9312378e revisited descriptor cleanup alongside on-demand partition-data loading, but its matching final patch is #439550 in thread #41687, so that landing belongs to the later thread.