model-writtenrun 9465 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Andres Freund reported that REINDEX INDEX CONCURRENTLY acquired ShareLock on the table before later needing ShareUpdateExclusiveLock, demonstrated deadlocks with pgbench, and proposed passing lock information through callback state #1.
- Peter Eisentraut initially proposed removing apparently unused heap-OID state #2, but Andres explained that RangeVarGetRelidExtended() can invoke the callback repeatedly during concurrent schema changes, requiring the previous table lock to be released #3 #5; Peter accepted that explanation #6.
- Peter replaced the cleanup with a callback structure carrying concurrency and the previously locked table OID, allowing matching lock and unlock modes, while noting that separate WaitForOlderSnapshots() deadlocks remained #7; Andres reviewed the state handling and found the change reasonable #8.
- Michael Paquier proposed a three-session isolation test #9, then reviewed Peter's fix, caught a comment typo, and attached tests reproducing the remaining snapshot deadlocks #10; he also demonstrated that CREATE INDEX CONCURRENTLY already had the same broader problem #11.
- Andres and Tom Lane considered the broader deadlock problem pre-existing and outside the PostgreSQL 12 fix's scope #12 #13, and Michael agreed that safely excluding relevant commands from snapshot waits was too complex for that stability work #14.
- Peter committed #7 as add85ead4a with only a comment correction and rewrapping, then confirmed completion #15; the diagnostic tests were not included, and the broader snapshot-deadlock issue remained deferred.