model-writtenrun 3191 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Heikki Linnakangas opened the thread by identifying a race between injection-point lookup and detach, and requesting execution without a PGPROC entry for early backend startup and postmaster testing #1.
- Tom Lane objected to taking even spinlocks in the postmaster and suggested removing locking or removal support #2; Noah Misch explained why tests could not reliably avoid concurrent access and suggested atomics, while Michael Paquier defended the ability to remove points dynamically #4 #5.
- After Noah demonstrated that premature lock release could cache the wrong callback #6, Michael acknowledged the fix and attached a broader proof of concept that removed all injection-point locking, added a BackendStartup() call site and supported shared-preload initialization; he also noted that postmaster ERROR handling and condition-variable waits limited its usefulness #7.
- Michael first landed the separate race fix as d85fc4be11, retaining the lock through cache loading and releasing it before callback execution, while also removing a redundant release before ERROR; he confirmed that the postmaster question remained unresolved #8.
- Heikki then replaced the lock-removal approach with a shared array and atomic generation counters, retaining writer locking while making injection-point execution independent of PGPROC; he acknowledged the theoretical risk of corrupted shared memory affecting postmaster execution #9.
- Tom accepted postmaster injection points as a debugging and testing feature #10, and Michael likewise supported that scope #11; Michael's detailed review requested clearer concurrency and barrier comments, return-value cleanup and explanations of cache data handling #12.
- Heikki incorporated the review in #13, explaining why concurrent detach and reattach can legitimately produce an old value, a new value or no callback, and why a changed generation should continue the scan; Michael accepted that reasoning and the revised comments #14.
- Heikki committed #13 unchanged as 86db52a506, with a backport to PostgreSQL 17, and announced completion in #15; Michael acknowledged it in #16, closing the thread with both locking changes landed but without the original proof of concept's postmaster call site or test-module initialization changes.