model-writtenrun 6972 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Andres Freund opened the thread after a btree root-buffer caching experiment exposed poor ReadRecentBuffer() scalability: its buffer-header spinlock performed worse than PinBuffer()'s compare-exchange loop and failed to increment usagecount; removing that bottleneck produced roughly a 7% gain in his concurrent benchmark #1.
- Thomas Munro, Andres Freund and Peter Geoghegan explored caching root-page copies and retaining pins, with Peter explaining that stale roots can remain searchable but snapshots are needed to prevent page recycling; Thomas warned that an LSN alone cannot detect buffer replacement #2 #4 #6 #7 #11.
- Ants Aasma supplied an older futex-backed spinlock experiment for testing, but Andres highlighted the cost of atomic operations during spinlock release on x86; this remained a separate experiment and was not incorporated into either candidate commit #12 #13 #15.
- Andres proposed checking a cached root page against both its LSN and a buffer-replacement counter, avoiding long-lived pins that could interfere with vacuum; this broader lock-avoidance design remained exploratory #16.
- Thomas established that randomly pinning invalid buffers could violate GetVictimBuffer() assumptions, then submitted a skip_if_not_valid mode for PinBuffer() alongside a separate btree root-buffer cache stored in rd_amcache #17.
- Andres endorsed the validity restriction, requested an unlocked tag precheck to avoid increasing the wrong buffer's usagecount, and questioned duplicating caching machinery across access methods; Thomas added the precheck and replaced the btree-specific experiment with a generic eight-entry LRU per relation fork #18 #19.
- Andres considered the generic LRU a separate facility and still favored practically overhead-free root-buffer caching, suggesting fields in RelationData for access methods to use; neither cache design reached a landing in this thread #20.
- After the work stalled, Andres revived the scalability patch in September 2025 because upcoming buffer-manager changes would conflict with it and make the old path slower; Thomas agreed that the usagecount change should not be backpatched without a demonstrated problem #21 #22 #23.
- The scalability work originating in #19 was subsequently forwarded in #601272 in thread #52147, which supplies the latest matching submission for 819dc118c0; Andres announced its landing here, explaining that an AIO test required deferring private reference-count entry creation and that invalid-buffer rejection was moved ahead of waiting for the header lock, while calling for renewed btree root-buffer caching work #25.
- Amit Langote reported a buildfarm Valgrind failure #26, and Andres anticipated a missing buffer-memory annotation #27; the matching fix was attached in #602789 in thread #52147 and landed as c819d1017d, centralizing annotation in TrackNewBufferPin(), with Andres clarifying here that a separate StrategyGetBuffer() change caused the regression #28.
- In January 2026, Ilyasov Ian reported about 34% higher throughput from Thomas's original btree root-buffer caching patch on a 96-core system; Andres clarified that only the scalability fix had landed and that ordinary performance improvements are not backpatched, while Ian confirmed the cache patch was the one tested, leaving that optimization uncommitted at the thread's end #30 #31 #32.