model-writtenrun 6949 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Doruk Yilmaz proposed exposing the internal replication-origin PID argument through a new SQL overload so external parallel-apply clients could share an origin #1.
- Euler Taveira recommended one function with an optional argument defaulting to zero and corresponding documentation, which Doruk implemented in place of the duplicate wrapper #2 #3.
- After several months, Euler reported successful multi-session testing, renamed the argument to pid, expanded its documentation, and supplied a revised patch while noting the missing automated tests #4.
- Amit Kapila questioned whether exposing origin sharing without enforcing commit order could cause incorrect replication; Doruk explained that his external workers replayed JSONL changes, coordinated commits, and used pg_replication_origin_xact_setup() rather than manually advancing origins #6 #9 #10 #11.
- Amit accepted that workflow and recommended documenting its requirements, leading Doruk to add a prominent commit-order caution and transaction workflow #12 #13.
- Hayato Kuroda questioned why clients needed SQL access instead of the C interface, and Doruk explained that the workers were external Python processes and managed deployments could not load custom server code #14 #15.
- Attribute review led to an explicit PARALLEL UNSAFE declaration, and Hayato considered that revision good #16 #18 #19 #20.
- At Amit's request, Hayato added multi-session tests and discovered that a failed PID check could leave session_replication_state assigned, so he included a fix postponing assignment until validation succeeded #22 #23.
- Hayato replaced TAP coverage with faster isolation tests, then incorporated Amit's early-validation approach and merged the feature, tests, and error-state fix into one patch; a separate inactive-origin check covered cases without an existing state slot #24 #25 #26.
- The PID feature landed from #26 as 5b148706c5, with light diagnostic and formatting edits, an isolation-test rename, and a catalog-version bump; although the commit also links thread #52238, this thread supplied the later matching patchset.
- Zhijie Hou subsequently demonstrated that resetting a shared origin could clear its ownership flag while another session still used it, allowing the origin to be dropped and its shared-memory slot reused; he proposed reference counting after off-list discussion and review with Hayato #27.
- Shveta Malik found assertion failures involving a third session and premature origin release, prompting Amit to propose rejecting the first session's reset until all sharing sessions had released the origin #29 #30 #31.
- Hayato implemented the reset restriction and separately blocked acquisition when the first session had exited but other users remained; Shveta then found that dropping such an origin still needed reference-count protection, which Hayato restored while improving diagnostics #32 #33 #34 #35.
- Shveta reported that her scenarios worked and requested test and comment refinements; Hayato combined the patches and clarified comments, but declined an additional drop assertion because the diagnostic contained a variable PID and the reset restriction prevented the original sequence #36 #37.
- After Shveta approved the combined patch, Amit committed it as e385a4e2fd, adding a reference-count check in replorigin_advance() to prevent manual advancement while an origin remained in use #38 #39.
- Heikki Linnakangas then proposed clearer PID error wording and reorganized setup validation, including reporting an inactive-origin error before a slot-capacity error when both conditions applied #40.
- Shveta supported the diagnostic change but requested clearer else-if structure and comments; Amit supported grouping checks by whether a PID was supplied and argued that the existing OBJECT_IN_USE error code remained defensible #41 #42 #43 #44.
- After the cleanup stalled, Amit took it over and posted a combined revision incorporating Shveta's suggestions, which she approved #46 #47 #48 #49.
- The cleanup landed from #48 as 735e8fe685 with only a blank-line adjustment, and Amit's final confirmation closed the thread with all three changes committed #50.