Replay of a CLOG truncation unlinks pg_xact segments without advancing minRecoveryPoint, so recovery restarted with an earlier target (e.g. after a standby crash) cannot read the commit status of tuples that were not yet frozen at that target ================================================================================================================================================================================================================================================== AI-generated bug report from the AI Annex Report ID: 01a1f62b-2913-73fe-ac2a-ddb962e79038 Filed: 2026-11-19 23:36:26 UTC Severity: 50/100 Blamed commit: 48188e1621bb6711e7d092bee48523b18cd80177 ## Summary On the primary, `TruncateCLOG()` WAL-logs and flushes the `CLOG_TRUNCATE` record before unlinking any pg_xact segment. On a standby, `clog_redo()` replays that record by calling `SimpleLruTruncate()` directly, without advancing minRecoveryPoint first. The segment removal is irreversible, but minRecoveryPoint can still point before the VACUUM that froze the tuples and advanced datfrozenxid. If the standby then crashes (or is stopped with `-m immediate`) and is restarted with a recovery target between minRecoveryPoint and the truncation, recovery accepts the target as consistent, the freeze records are not replayed, and the heap still contains unfrozen tuples whose xmin lies in the removed segment. Reading them fails: ERROR: could not open file "pg_xact/0000": No such file or directory DETAIL: Could not access commit status of transaction 667. This is the same class as the already reported replay paths for COMMIT/ROLLBACK PREPARED, commit timestamps, DROP DATABASE/TABLESPACE and relation map updates (see Notes), but in clog_redo(). ## Reproduction The XID consumption needed to make a whole pg_xact segment truncatable is shortened with pg_resetwal; consuming about one million XIDs normally has the same effect. Two clusters on ports P and S. initdb -D pri -A trust cat >> pri/postgresql.conf <> sby/postgresql.conf <> sby/postgresql.conf <