Re: An improvement of ProcessTwoPhaseBuffer logic

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: Vitaly Davydov <v.davydov@postgrespro.ru>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2024-12-26T05:34:48Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Integrate FullTransactionIds deeper into two-phase code

  2. Merge copies of converting an XID to a FullTransactionId.

  3. Revert recent changes related to handling of 2PC files at recovery

  4. Fix failures with incorrect epoch handling for 2PC files at recovery

Attachments

On Thu, Dec 26, 2024 at 07:42:34AM +0900, Michael Paquier wrote:
> I suspect that this can be still dangerous as-is while complicating
> the code with more possible paths for the removal of the 2PC files,
> because we may still build a file name from an XID, and that's what's
> causing this issue..

Here are two patches to address both issues:
- 0001 for the epoch calculation, down to 17, which would take care of
the underflow problem when having a 2PC file that has an XID in the
future at epoch 0.  It is true that it could be smarter when dealing
with files from other epochs, and that this is a problem in v17~.  I
think that this should integrate better with FullTransactionIds moving
forward rather than pass the file names.  That would be something
quite invasive, only for HEAD.  At least that's my impression.
- 0002, to take care of the future file issue, down to 13.  This
includes a TAP test to demonstrate the problem.  The test needs a
tweak for the 2PC file name in v17~.
--
Michael