model-writtenrun 1497 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Michael Paquier opened the thread with a reproducer from Tenglong Gu and Daisuke Higuchi, explaining that dropping a subscription during initial COPY rolls back the replication-origin catalog entry while leaving persistent shared-memory state that cannot be cleaned up by the catalog-based lookup #1.
- Amit Kapila initially preferred an error-cleanup callback #2, while Masahiko Sawada highlighted ordinary COPY failures, restart handling, and NULL external identifiers, favoring a short creation transaction subject to checking origin reuse #3; Michael likewise preferred consistency with apply workers over exposing internal cleanup machinery #4.
- Amit requested explanations and updated state-related comments if creation moved earlier #5, and Michael reasoned that subscription and relation identifiers keep origin names stable across worker restarts while origin advancement must remain in the COPY transaction #6.
- Zhijie Hou implemented creation within the existing DATASYNC transaction, removed the duplicate-origin error so retries can reuse the reserved origin name, and added a regression assertion using an existing COPY-failure test #7; Amit agreed that the identifiers remain stable across restarts #8.
- Amit requested clearer transaction and origin-setup comments #9, which Hou incorporated without changing the implementation #10, and Masahiko approved the revised patch #11.
- Michael endorsed the transaction placement and planned additional error-injection checks #12, then committed the revised patch with only test formatting changes as 8e0d32a4a1; he reported successful cross-branch investigation and backpatching through PostgreSQL 14 while flagging a now-incomplete pg_upgrade comment #13.
- Amit supplied a separate patch explaining that upgrading a table in DATASYNC would retain both its replication slot and origin #14, and Michael approved it in the thread's last message #15.
- The comment follow-up subsequently landed as a1cdb81201, with light wording changes from #14 and backpatches through PostgreSQL 17, completing both submitted changes.