model-writtenrun 8359 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Tom Lane opened the thread by questioning atomic operations inside spinlocks in WAL receiver statistics and buffer replacement, citing nested-lock safety and unclear protection rules #1; Andres Freund defended their usefulness for coordinating lock-free fast paths with locked slow paths #2.
- Thomas Munro and Michael Paquier agreed that the WAL receiver atomic read could move after lock release #3 #4, while Tom proposed simplifying buffer replacement with a continuously increasing atomic counter #5; Andres identified division costs, older-branch limitations, and inconsistent background-writer accounting as obstacles #7 #12.
- Tom identified the risk that nested locks could map onto the same emulation semaphore #9, and Andres found that separate semaphore pools were already intended but s_init_lock_sema() ignored its nested argument #11.
- Testing with both atomics and spinlocks disabled exposed a separate global-barrier deadlock: a signal handler could read a 64-bit atomic while its emulation lock was already held #13; Andres also reproduced invalid semaphore indexes after the signed initialization counter overflowed #15.
- Tom and Andres discussed prohibiting unsafe atomic operations in signal handlers, dropping legacy emulation support, and possible signal-safe alternatives, but disagreed about the remaining platform constraints and did not implement those broader proposals here #14 #15 #16 #17.
- Andres submitted four patches: a provisional switch to 32-bit barrier generations, an unsigned semaphore counter, basic regression tests, and separate semaphore pools for nested atomics #18; the expensive overflow test was included provisionally despite its runtime.
- Andres then proposed retaining 64-bit generations and deferring their inspection out of the signal handler through a dedicated barrier signal #19; Robert Haas supported that approach and requested combined-disable buildfarm coverage #20, which Andres agreed to provide #21.
- The revised series implemented deferred barrier processing and retained the other three patches #28; Robert reviewed all four, questioning the tests' portability and reliance on hangs or assertions while requesting clearer explanations #29, and Andres defended their practical value for reproducing the bugs #31.
- The revised barrier fix and unsigned-counter fix landed unchanged from #28 as fd49d53807 and 4d4ca24efe.
- Review of the tests developed into a debate over the S_LOCK and SpinLock abstraction layers: Andres and Robert favored simpler inline interfaces #33 #34, while Tom advocated limiting changes to spin.h to avoid disturbing architecture-specific implementations #37 #41.
- That abstraction discussion led Andres to identify three unnecessary or inappropriate s_lock.h includes and propose their cleanup #42; the proposal subsequently landed without an attached patch as f219167910.
- The basic regression tests from #28 landed as 3b37a6de02 with clearer comments, byte-array sentinels, and an explicit spin.h include; the separate-pool deadlock fix landed as cf1234a10e with naming cleanup and additional 64-bit atomic test coverage.
- At the final message, Andres reported that the new combined-disable buildfarm animal was live #43; all four revised patches had landed, while the expensive test's long-term retention and broader spinlock-interface changes remained open.
- The later inline-wrapper conversion bfc321b472 cites the suggestion in #33, but its implementation came from the February 2026 submission #615743 in thread #53351.