Re: The same 2PC data maybe recovered twice
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: "suyu.cmj" <mengjuan.cmj@alibaba-inc.com>
Cc: pgsql-bugs <pgsql-bugs@lists.postgresql.org>
Date: 2025-07-09T07:35:23Z
Lists: pgsql-bugs, pgsql-hackers
On Wed, Jul 09, 2025 at 01:51:03PM +0800, suyu.cmj wrote: > Currently, since restoreTwoPhaseData() is the only function that > restores 2PC transactions from disk before the recovery starts, > after reaching a consistent state, the 2PC transactions are only > added from the WAL. Under normal circumstances, there should not be > any corresponding 2PC files on the storage at that point. Therefore, > I prefer to perform the file access checks only when the server has > not yet reached a consistent state. Once consistency has been > reached, if a duplicate 2PC transaction is added, it will directly > result in an error in the subsequent replay logic. There is a bit more going on in this code that needs to be fixed. Please see the following thread, that also relates to the state of the 2PC recovery code when we read them from disk at the beginning of recovery, with the bottom part being the most relevant: https://www.postgresql.org/message-id/Z5sd5O9JO7NYNK-C%40paquier.xyz -- Michael
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Fix recovery of 2PC transaction during crash recovery
- bc0581f8fb8b 11.21 landed
- d2ee542a2bbe 12.16 landed
- db59108a2b67 13.12 landed
- 442749100d34 14.9 landed
- a878eff6b4b9 15.4 landed
- f88bc9f38839 16.0 landed
- cb0cca188072 17.0 landed