model-writtenrun 8019 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
Jul - Sep 2019 · 9 entries
- Andres Freund opened the discussion by identifying duplicated partition routing, oversized cross-partition UPDATE logic and fragile transition-capture state in nodeModifyTable.c #1.
- Amit Langote explained that routing had been moved outward to avoid failing to restore state on early returns, but Andres proposed passing ResultRelInfo explicitly and eliminating the query-global active-relation pointer #2 #3.
- Etsuro Fujita raised extension-compatibility concerns, so Amit's first implementation retained the global pointer for FDWs while reducing core dependencies and extracting row movement #5 #6.
- Andres reviewed the implementation and requested clearer arguments and naming, while Alvaro Herrera identified its inverted return convention; Amit incorporated those changes and added per-relation transition conversion maps #7 #8 #10.
- Amit then proposed passing ResultRelInfo into BeginDirectModify and removing es_result_relation_info entirely, while Etsuro supplied an alternative using an RT index and executor lookup #11 #15.
- Andres objected to both moving BeginDirectModify into ModifyTable and making FDWs search for their ResultRelInfo, while Tom Lane favored an explicit parameter when changing the API #16 #18 #22.
- The resulting compromise kept BeginDirectModify in ExecInitForeignScan and supplied a planner-computed result-relation index; Etsuro's replacement moved index adjustment into ForeignScan reference processing so intermediate plan nodes would remain possible #29 #30 #31.
- Amit folded in that replacement and corrected obsolete references, after which Etsuro polished the FDW documentation, comments and presentation #34 #36 #38 #39.
- The series then spent more than a year in periodic rebases, with Amit reiterating in July 2020 that its purpose was simpler executor state management rather than new functionality #42 #43 #45 #47.
Oct 2020 · 14 entries
- Heikki Linnakangas restarted substantive review by questioning fragile index assignment and setrefs ordering, prompting an explicit context-based revision #48 #49.
- Heikki and Amit then chose an RT-indexed array of ResultRelInfo pointers instead, eliminating separate result-relation indexes and replacing the temporary setrefs refactor #50 #52.
- Heikki consolidated cleanup routines and simplified allocation, but Amit identified that removing the planned target-relation list would obstruct future lazy initialization; Heikki retained that list and committed the revised indexing foundation as 1375422c78 #53 #55 #56 #57.
- For the next two patches, Heikki returned target-index assignment to FDWs and then moved the ResultRelInfo pointer into ForeignScanState; those members of #60 landed separately as 178f2d560d and a04daa97a4, with only light edits.
- Amit supplied a delta delaying ForeignScanState.resultRelInfo initialization, but Heikki deferred it because avoiding initialization overhead would also require reconsidering BeginDirectModify itself #61 #62.
- Heikki committed the cross-partition extraction from #52 as c5b097f8fa, leaving out the trigger-call restructuring because he was unconvinced it improved readability #64.
- Heikki also questioned the remaining duplicate conversion maps, leading Amit to consolidate them into ri_ChildToRootMap; Alvaro examined map ownership and initialization paths before accepting the simplification #64 #65 #66 #68.
- Amit added a separate PartitionRoutingInfo removal patch, and the two members of #69 landed with light edits as 6973533650 and fb5883da86.
- While committing that pair, Heikki independently simplified root-target lookup by always setting rootResultRelInfo, producing f49b85d783 without a matching attached patch #70.
- Amit followed with lazy initialization of ResultRelInfos and selected fields, discovering that the earlier indexing commit mistakenly reset the parent executor's result-relation array during EvalPlanQual setup #74.
- After Alvaro asked about a reproducer, Amit explained why existing execution paths masked the error but lazy initialization exposed it; the first member of #74 landed unchanged as 22b73d3cb0 #75 #76 #77.
- Heikki requested performance evidence and questioned the FDW consequences, while Amit explained that lazy initialization complemented runtime pruning and cited previously measured gains at high partition counts #78 #79 #80.
- Amit revised the remaining patches to defer BeginDirectModify itself, observing that this would make the newly added ForeignScan.resultRelation field unnecessary #82.
- The original cleanup work was committed, but the two lazy-initialization patches remained pending; Amit closed out this thread by moving them back to their original discussion after rebasing the related UPDATE/DELETE overhaul #83 #84.