replace InvalidXid(a macro that doesn't exist) with InvalidTransactionId(a macro that exists) in code comments

Started by Bharath Rupireddyover 4 years ago2 messages
#1Bharath Rupireddy
bharath.rupireddyforpostgres@gmail.com
1 attachment(s)

Hi,

It seems like we have macro InvalidTransactionId but InvalidXid is
used in some of the code comments.Here's a small patch that does
$subject?

Regards,
Bharath Rupireddy.

Attachments:

v1-0001-replace-InvalidXid-with-InvalidTransactionId-in-c.patchapplication/octet-stream; name=v1-0001-replace-InvalidXid-with-InvalidTransactionId-in-c.patchDownload
From 40c9b13db02876410938dec4ac92fb3e988ec222 Mon Sep 17 00:00:00 2001
From: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Date: Mon, 4 Oct 2021 08:15:34 +0000
Subject: [PATCH v1] replace InvalidXid with InvalidTransactionId in code
 comments

---
 src/backend/access/heap/heapam.c | 6 +++---
 src/backend/utils/time/snapmgr.c | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c
index 2a264c6ac1..063e45345b 100644
--- a/src/backend/access/heap/heapam.c
+++ b/src/backend/access/heap/heapam.c
@@ -3589,9 +3589,9 @@ l2:
 	/*
 	 * And also prepare an Xmax value for the new copy of the tuple.  If there
 	 * was no xmax previously, or there was one but all lockers are now gone,
-	 * then use InvalidXid; otherwise, get the xmax from the old tuple.  (In
-	 * rare cases that might also be InvalidXid and yet not have the
-	 * HEAP_XMAX_INVALID bit set; that's fine.)
+	 * then use InvalidTransactionId; otherwise, get the xmax from the old
+	 * tuple. (In rare cases that might also be InvalidTransactionId and yet
+	 * not have the HEAP_XMAX_INVALID bit set; that's fine.)
 	 */
 	if ((oldtup.t_data->t_infomask & HEAP_XMAX_INVALID) ||
 		HEAP_LOCKED_UPGRADED(oldtup.t_data->t_infomask) ||
diff --git a/src/backend/utils/time/snapmgr.c b/src/backend/utils/time/snapmgr.c
index dca1bc8afc..5001efdf7a 100644
--- a/src/backend/utils/time/snapmgr.c
+++ b/src/backend/utils/time/snapmgr.c
@@ -919,9 +919,9 @@ xmin_cmp(const pairingheap_node *a, const pairingheap_node *b, void *arg)
 /*
  * SnapshotResetXmin
  *
- * If there are no more snapshots, we can reset our PGPROC->xmin to InvalidXid.
- * Note we can do this without locking because we assume that storing an Xid
- * is atomic.
+ * If there are no more snapshots, we can reset our PGPROC->xmin to
+ * InvalidTransactionId. Note we can do this without locking because we assume
+ * that storing an Xid is atomic.
  *
  * Even if there are some remaining snapshots, we may be able to advance our
  * PGPROC->xmin to some degree.  This typically happens when a portal is
-- 
2.25.1

#2Daniel Gustafsson
daniel@yesql.se
In reply to: Bharath Rupireddy (#1)
Re: replace InvalidXid(a macro that doesn't exist) with InvalidTransactionId(a macro that exists) in code comments

On 4 Oct 2021, at 10:19, Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com> wrote:

It seems like we have macro InvalidTransactionId but InvalidXid is
used in some of the code comments.Here's a small patch that does
$subject?

While I doubt anyone would be confused by these, I do agree it's worth being
consistent and use the right terms. Pushed to master, thanks!

--
Daniel Gustafsson https://vmware.com/