doubt about FullTransactionIdAdvance() - Mailing list pgsql-hackers

From Zhang Mingli
Subject doubt about FullTransactionIdAdvance()
Date
Msg-id 28a845ea-d31b-4631-8347-4d0ac5e21c1b@Spark
Whole thread Raw
Responses Re: doubt about FullTransactionIdAdvance()
List pgsql-hackers
Hi, hackers

I don't quite understand FullTransactionIdAdvance(), correct me if I’m wrong.


/*
 * Advance a FullTransactionId variable, stepping over xids that would appear
 * to be special only when viewed as 32bit XIDs.
 */
static inline void
FullTransactionIdAdvance(FullTransactionId *dest)
{
dest->value++;

/* see FullTransactionIdAdvance() */
if (FullTransactionIdPrecedes(*dest, FirstNormalFullTransactionId))
 return;

while (XidFromFullTransactionId(*dest) < FirstNormalTransactionId)
 dest->value++;
}

#define XidFromFullTransactionId(x) ((x).value)
#define FullTransactionIdPrecedes(a, b) ((a).value < (b).value)

Can the codes reach line: while (XidFromFullTransactionId(*dest) < FirstNormalTransactionId)?
As we will return if (FullTransactionIdPrecedes(*dest, FirstNormalFullTransactionId)), and the two judgements seem equal.
Another confusion is the comments: /* see FullTransactionIdAdvance() */, is its own  itself.
Could anyone explain this? Thanks in advance.

Regards,
Zhang Mingli

pgsql-hackers by date:

Previous
From: Zhang Mingli
Date:
Subject: Re: Add 64-bit XIDs into PostgreSQL 15
Next
From: Alvaro Herrera
Date:
Subject: Re: Crash after a call to pg_backup_start()