model-writtenrun 7218 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
Aug - Sep 2023 ยท 16 entries
- Amit Kapila opened the thread with Julien Rouhaud's extracted patch to flush logical slots during shutdown, supporting future slot upgrades and avoiding repeated decoding after restart; Julien agreed that shutdown flushing was preferable to frequent writes during normal operation #1 #2.
- After Amit suggested another dirty flag, Ashutosh Bapat proposed remembering the last saved confirmed_flush LSN instead, and the discussion settled on using that value at shutdown while leaving periodic flushing as a separately justified optimization #3 #4 #5 #7 #8.
- Hayato Kuroda added a test to the original unconditional-flush implementation, and Vignesh then implemented conditional flushing using the remembered LSN #9 #10.
- Hayato discovered that the test passed without the fix because pg_logical_slot_get_changes already dirtied the slot, supplied a subscription-based replacement, and identified incorrect initialization of the remembered LSN; Vignesh integrated these corrections and used the decoding log to inspect the restored value #11 #13.
- Vignesh supplied diagnostic logging and a separately rebased pg_replslotdata utility to demonstrate that filtered transactions were not processed again and that the saved LSN reached the shutdown checkpoint, while Hayato independently verified logical slots on a physical standby #14 #15 #16.
- Amit revised the implementation and test, and Vignesh moved the test into the recovery suite while incorporating formatting fixes and Peter Smith's offline comments #17 #18.
- Ashutosh found that copying the current in-memory confirmed_flush after writing could record an LSN that had never reached disk, and proposed taking the value from the written snapshot and marking slots dirty in CheckPointReplicationSlots instead of passing shutdown state into SaveSlotToPath #23.
- The reviewers debated reading the restored LSN from a server log versus querying the slot directly; Amit retained the log-based test because it exposes the restored value before later activity changes it, and Ashutosh acknowledged that decoding-context creation did not itself advance the value #26 #28 #31 #32.
- Vignesh implemented the snapshot-based saved value and checkpoint dirty marking, restored autovacuum suppression in the test, and excluded invalidated slots at Amit's request #29 #30.
- Hou Zhijie explained why just_dirtied should accompany dirty, and Dilip Kumar requested an explanation for limiting the extra flushes to shutdown; Vignesh incorporated both changes #35 #37 #40.
- Dilip explored reusing a common dirty-marking function without holding the slot mutex for the checks, but Hou and Amit favored preserving normal locking conventions, and Dilip accepted that decision #41 #42 #44 #47.
- Vignesh reported successful check-world, Meson and formatting checks, after which Michael Paquier and Ashutosh prompted further clarification of the saved-LSN field and checkpoint comments #48 #50 #52 #56.
- Michael questioned shutdown ordering and the use of 'persist' for flushing slot data; Amit clarified that logical walsenders stop before the shutdown checkpoint, and subsequent revisions removed the bgwriter reference and adopted clearer flushing terminology #57 #58 #59 #60 #61.
- Michael proposed a strict greater-than comparison, but Amit favored checking for any changed value and asserting that the LSN never retreats; Michael accepted the assertion compromise and approved the resulting final patch #62 #65 #66 #67.
- Amit committed #66 unchanged as e0b2eed047 and announced the push; the diagnostic logging and pg_replslotdata utility were not included, and periodic flushing remained outside this change #68 #14 #15 #7.
- The thread ended with the shutdown-flushing change landed and Michael updating the Commitfest entry to Committed after Ashutosh noticed its stale status #69 #70.