Re: An improvement of ProcessTwoPhaseBuffer logic

From: "Vitaly Davydov" <v(dot)davydov(at)postgrespro(dot)ru>
To: "Michael Paquier" <michael(at)paquier(dot)xyz>
Cc: "pgsql-hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: An improvement of ProcessTwoPhaseBuffer logic
Date: 2024-12-27 15:16:24
Message-ID: 16aa85-676ec500-3d-23db9b40@59039559
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Friday, December 27, 2024 10:37 MSK, Michael Paquier <michael(at)paquier(dot)xyz> wrote:

> So please see the attached. You will note that RemoveTwoPhaseFile(),
> ProcessTwoPhaseBuffer() and TwoPhaseFilePath() now require a
> FullTransactionId, hence callers need to think about the epoch to use.
> That should limit future errors compared to passing the file name as
> optional argument.

In general, I like your solution to use FullTransactionId. I haven't found any evident problems. I just would like to propose to create a couple of new functions like RemoveTwoPhaseFileInCurrentEpoch, TwoPhaseFilePathInCurrentEpoch which accept TransactionId instead FullTransactionId. It may make the code clearer and result into less boilerplate code. I tried to do some hand testing. It seems, the problem is gone with the patch. Thank you!

As an idea, I would like to propose to store FullTransactionId in global transaction state instead of TransactionId. I'm not sure, it will consume significant additional memory, but it make the code more clear and probably result into less number of locks.

With best regards,
Vitaly

Attachment Content-Type Size
0001-Some-cosmetic-fixes.patch text/x-patch 5.1 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message jian he 2024-12-27 15:19:29 Re: Re: proposal: schema variables
Previous Message Bruce Momjian 2024-12-27 15:12:34 Re: [PATCHES] Post-special page storage TDE support