model-writtenrun 3012 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- 清浅 reported a race in which another prepared transaction could reuse shared state and clear the ondisk flag before file cleanup, leaving an orphaned two-phase state file that could prevent restart after pg_xact truncation #1.
- The proposed fix cached the ondisk flag before returning the shared state to the free list and used that local value for file cleanup #1.
- Michael Paquier said he had not encountered the problem in practice and would investigate #2.
- Michael Paquier committed the patch with an explanatory locking comment as cf4401fe6c, retaining the implementation from #1.
- Michael Paquier confirmed the bug, acknowledged introducing it, and reported backpatching the fix to all supported branches; the thread ended with the fix landed #3.