1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-09 06:21:09 +03:00

Use XLogRecPtrIsValid() in various places

Now that commit 06edbed478 has introduced XLogRecPtrIsValid(), we can
use that instead of:

- XLogRecPtrIsInvalid()
- direct comparisons with InvalidXLogRecPtr
- direct comparisons with literal 0

This makes the code more consistent.

Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: https://postgr.es/m/aQB7EvGqrbZXrMlg@ip-10-97-1-34.eu-west-3.compute.internal
This commit is contained in:
Álvaro Herrera
2025-11-06 20:33:57 +01:00
parent 06edbed478
commit a2b02293bc
46 changed files with 239 additions and 238 deletions

View File

@@ -2198,7 +2198,7 @@ ProcessTwoPhaseBuffer(FullTransactionId fxid,
Assert(LWLockHeldByMeInMode(TwoPhaseStateLock, LW_EXCLUSIVE));
if (!fromdisk)
Assert(prepare_start_lsn != InvalidXLogRecPtr);
Assert(XLogRecPtrIsValid(prepare_start_lsn));
/* Already processed? */
if (TransactionIdDidCommit(XidFromFullTransactionId(fxid)) ||
@@ -2547,7 +2547,7 @@ PrepareRedoAdd(FullTransactionId fxid, char *buf,
* the record is added to TwoPhaseState and it should have no
* corresponding file in pg_twophase.
*/
if (!XLogRecPtrIsInvalid(start_lsn))
if (XLogRecPtrIsValid(start_lsn))
{
char path[MAXPGPATH];
@@ -2587,7 +2587,7 @@ PrepareRedoAdd(FullTransactionId fxid, char *buf,
gxact->owner = hdr->owner;
gxact->locking_backend = INVALID_PROC_NUMBER;
gxact->valid = false;
gxact->ondisk = XLogRecPtrIsInvalid(start_lsn);
gxact->ondisk = !XLogRecPtrIsValid(start_lsn);
gxact->inredo = true; /* yes, added in redo */
strcpy(gxact->gid, gid);