model-writtenrun 7153 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Floris Van Nee reported that PostgreSQL 15.5 physical replicas shut down during WAL replay with “can only drop stats once” and recovered after a manual restart; Tom Lane tentatively suggested skipping already-dropped entries but questioned the return value and how recovery reached this state #1 #2.
- After the failures persisted, Tom proposed enriching the error with the entry's hash key and statistics kind; Andres Freund rejected silently ignoring inconsistent statistics lifetimes and attached a diagnostic patch implementing that direction #3 #4 #6.
- Andres suspected OID wraparound combined with missed statistics garbage collection and a long-lived startup process; Floris confirmed rapid OID consumption but later explained why the known missing-GC issue did not fully account for this recovery failure #7 #8 #9.
- Michael Paquier supported the diagnostic improvement and proposed adding the reference count; Floris requested backpatching, and Michael posted a revision combining Andres's patch with Bertrand Drouvot's related work #10 #11 #12.
- Bertrand preferred placing the extra data in errdetail_internal(), but Kyotaro Horiguchi, Michael, and Andres favored keeping it directly in elog() for visibility, and Bertrand accepted that choice #13 #14 #15 #16 #17.
- Michael committed the revised attachment #12 unchanged as d92573adcb and announced backpatches through PostgreSQL 15; this attachment superseded the earlier proposal in thread #49630 and improved diagnostics without fixing the underlying double-drop bug #18.
- Floris subsequently supplied a local reproduction using simulated OID wraparound: a standby backend retained the old statistics entry, while recovery replayed drops without creating and reinitializing statistics when the relation was recreated #19.
- Michael proposed removing statistics on the first replayed drop, but Floris explained that outstanding backend references prevented immediate freeing and that changing the garbage-collection notification mechanism would be difficult to backpatch #20 #21.
- Kyotaro discussed recovery-specific tolerance for repeated operations; Michael distinguished this failure in a consistent standby and proposed adding an age to shared and locally referenced statistics entries, acknowledging that the design would not be backpatchable #22 #23.
- Michael moved the underlying bug discussion to another thread; the final exchange compared the proposed age mechanism with an older design and clarified that it would prevent backends from manipulating stale shared entries, leaving the diagnostic change landed and the actual fix unresolved here #24 #25 #26.