Revert recent changes related to handling of 2PC files at recovery
commita6c70f68cdeb3bed591a2dd7d421bf3536ba5216
authorMichael Paquier <michael@paquier.xyz>
Fri, 17 Jan 2025 04:27:39 +0000 (17 13:27 +0900)
committerMichael Paquier <michael@paquier.xyz>
Fri, 17 Jan 2025 04:27:39 +0000 (17 13:27 +0900)
tree509218b67c1eb4edd0fb97dde8697e1632ceec0b
parent0dc9c7d200e59b19b2e683f78afa1ee4cfcf3c21
Revert recent changes related to handling of 2PC files at recovery

This commit reverts 8f67f994e8ea (down to v13) and c3de0f9eed38 (down to
v17), as these are proving to not be completely correct regarding two
aspects:
- In v17 and newer branches, c3de0f9eed38's check for epoch handling is
incorrect, and does not correctly handle frozen epochs.  A logic closer
to widen_snapshot_xid() should be used.  The 2PC code should try to
integrate deeper with FullTransactionIds, 5a1dfde8334b being not enough.
- In v13 and newer branches, 8f67f994e8ea is a workaround for the real
issue, which is that we should not attempt CLOG lookups without reaching
consistency.  This exists since 728bd991c3c4, and this is reachable with
ProcessTwoPhaseBuffer() called by restoreTwoPhaseData() at the beginning
of recovery.

Per discussion with Noah Misch.

Discussion: https://postgr.es/m/20250116010051.f3.nmisch@google.com
Backpatch-through: 13
src/backend/access/transam/twophase.c
src/test/recovery/t/009_twophase.pl