ReadNewTransactionId() -> ReadNextTransactionId().
authorThomas Munro <[email protected]>
Mon, 15 Feb 2021 00:03:10 +0000 (13:03 +1300)
committerThomas Munro <[email protected]>
Mon, 15 Feb 2021 00:17:02 +0000 (13:17 +1300)
The new name conveys the effect better, is more consistent with similar
functions ReadNextMultiXactId(), ReadNextFullTransactionId(), and
matches the name of the variable that it reads.

Reported-by: Peter Geoghegan <[email protected]>
Discussion: https://postgr.es/m/CAH2-WzmVR4SakBXQUdhhPpMf1aYvZCnna5%3DHKa7DAgEmBAg%2B8g%40mail.gmail.com

src/backend/access/gin/ginvacuum.c
src/backend/access/nbtree/nbtpage.c
src/backend/access/transam/commit_ts.c
src/backend/access/transam/xact.c
src/backend/commands/vacuum.c
src/backend/postmaster/autovacuum.c
src/include/access/transam.h

index 35b85a9bff0c0bb0c82ff06f92784c818522656f..a0453b36cde5b6d89b0443852cd9195304725ffc 100644 (file)
@@ -189,7 +189,7 @@ ginDeletePage(GinVacuumState *gvs, BlockNumber deleteBlkno, BlockNumber leftBlkn
     * address.
     */
    GinPageSetDeleted(page);
-   GinPageSetDeleteXid(page, ReadNewTransactionId());
+   GinPageSetDeleteXid(page, ReadNextTransactionId());
 
    MarkBufferDirty(pBuffer);
    MarkBufferDirty(lBuffer);
index ac264a5952d140982cc1e3f33d35b1d2b8dc2dcd..8c326a4774cbe55062d835084daad4cd43720825 100644 (file)
@@ -2266,7 +2266,7 @@ _bt_mark_page_halfdead(Relation rel, Buffer leafbuf, BTStack stack)
  *
  * We maintain *oldestBtpoXact for pages that are deleted by the current
  * VACUUM operation here.  This must be handled here because we conservatively
- * assume that there needs to be a new call to ReadNewTransactionId() each
+ * assume that there needs to be a new call to ReadNextTransactionId() each
  * time a page gets deleted.  See comments about the underlying assumption
  * below.
  *
@@ -2559,7 +2559,7 @@ _bt_unlink_halfdead_page(Relation rel, Buffer leafbuf, BlockNumber scanblkno,
     * Mark the page itself deleted.  It can be recycled when all current
     * transactions are gone.  Storing GetTopTransactionId() would work, but
     * we're in VACUUM and would not otherwise have an XID.  Having already
-    * updated links to the target, ReadNewTransactionId() suffices as an
+    * updated links to the target, ReadNextTransactionId() suffices as an
     * upper bound.  Any scan having retained a now-stale link is advertising
     * in its PGPROC an xmin less than or equal to the value we read here.  It
     * will continue to do so, holding back the xmin horizon, for the duration
@@ -2570,7 +2570,7 @@ _bt_unlink_halfdead_page(Relation rel, Buffer leafbuf, BlockNumber scanblkno,
    Assert(P_ISHALFDEAD(opaque) || !P_ISLEAF(opaque));
    opaque->btpo_flags &= ~BTP_HALF_DEAD;
    opaque->btpo_flags |= BTP_DELETED;
-   opaque->btpo.xact = ReadNewTransactionId();
+   opaque->btpo.xact = ReadNextTransactionId();
 
    /*
     * Remove the remaining tuples on the page.  This keeps things simple for
index 9f42461e12c2c6e700f9cccd970fd4ed859fde5c..48e8d662860872d039ec50d51b2ed624a782a78e 100644 (file)
@@ -733,7 +733,7 @@ ActivateCommitTs(void)
    if (ShmemVariableCache->oldestCommitTsXid == InvalidTransactionId)
    {
        ShmemVariableCache->oldestCommitTsXid =
-           ShmemVariableCache->newestCommitTsXid = ReadNewTransactionId();
+           ShmemVariableCache->newestCommitTsXid = ReadNextTransactionId();
    }
    LWLockRelease(CommitTsLock);
 
index 3c8b4eb36223c41b66dc52b97e88661f39ee05ba..17fbc41bbb71c1a38a216d5714d370abae138dee 100644 (file)
@@ -548,7 +548,7 @@ GetStableLatestTransactionId(void)
        lxid = MyProc->lxid;
        stablexid = GetTopTransactionIdIfAny();
        if (!TransactionIdIsValid(stablexid))
-           stablexid = ReadNewTransactionId();
+           stablexid = ReadNextTransactionId();
    }
 
    Assert(TransactionIdIsValid(stablexid));
index 0f77c5aff499c0ce8831213d45dc38bbbf2de501..c064352e237fb7468651f0dad5c58d8b5d017481 100644 (file)
@@ -1014,7 +1014,7 @@ vacuum_set_xid_limits(Relation rel,
     * autovacuum_freeze_max_age / 2 XIDs old), complain and force a minimum
     * freeze age of zero.
     */
-   safeLimit = ReadNewTransactionId() - autovacuum_freeze_max_age;
+   safeLimit = ReadNextTransactionId() - autovacuum_freeze_max_age;
    if (!TransactionIdIsNormal(safeLimit))
        safeLimit = FirstNormalTransactionId;
 
@@ -1097,7 +1097,7 @@ vacuum_set_xid_limits(Relation rel,
         * Compute XID limit causing a full-table vacuum, being careful not to
         * generate a "permanent" XID.
         */
-       limit = ReadNewTransactionId() - freezetable;
+       limit = ReadNextTransactionId() - freezetable;
        if (!TransactionIdIsNormal(limit))
            limit = FirstNormalTransactionId;
 
@@ -1314,7 +1314,7 @@ vac_update_relstats(Relation relation,
    if (TransactionIdIsNormal(frozenxid) &&
        pgcform->relfrozenxid != frozenxid &&
        (TransactionIdPrecedes(pgcform->relfrozenxid, frozenxid) ||
-        TransactionIdPrecedes(ReadNewTransactionId(),
+        TransactionIdPrecedes(ReadNextTransactionId(),
                               pgcform->relfrozenxid)))
    {
        pgcform->relfrozenxid = frozenxid;
@@ -1401,7 +1401,7 @@ vac_update_datfrozenxid(void)
     * validly see during the scan.  These are conservative values, but it's
     * not really worth trying to be more exact.
     */
-   lastSaneFrozenXid = ReadNewTransactionId();
+   lastSaneFrozenXid = ReadNextTransactionId();
    lastSaneMinMulti = ReadNextMultiXactId();
 
    /*
@@ -1577,7 +1577,7 @@ vac_truncate_clog(TransactionId frozenXID,
                  TransactionId lastSaneFrozenXid,
                  MultiXactId lastSaneMinMulti)
 {
-   TransactionId nextXID = ReadNewTransactionId();
+   TransactionId nextXID = ReadNextTransactionId();
    Relation    relation;
    TableScanDesc scan;
    HeapTuple   tuple;
index 5360604933e230d2c972ed1ceeb7fd1b02ef045e..8da5e5c9c39da787cb4bc01cd7b846b21752e886 100644 (file)
@@ -1190,7 +1190,7 @@ do_start_worker(void)
     * pass without forcing a vacuum.  (This limit can be tightened for
     * particular tables, but not loosened.)
     */
-   recentXid = ReadNewTransactionId();
+   recentXid = ReadNextTransactionId();
    xidForceLimit = recentXid - autovacuum_freeze_max_age;
    /* ensure it's a "normal" XID, else TransactionIdPrecedes misbehaves */
    /* this can cause the limit to go backwards by 3, but that's OK */
@@ -1709,7 +1709,7 @@ AutoVacWorkerMain(int argc, char *argv[])
            pg_usleep(PostAuthDelay * 1000000L);
 
        /* And do an appropriate amount of work */
-       recentXid = ReadNewTransactionId();
+       recentXid = ReadNextTransactionId();
        recentMulti = ReadNextMultiXactId();
        do_autovacuum();
    }
index e07dd83550f4092461c9d3b433cc96f71b5cb1fa..82e874130d07921472c7f6cc5c29f43875ab03ad 100644 (file)
@@ -305,7 +305,7 @@ extern void AssertTransactionIdInAllowableRange(TransactionId xid);
  * For callers that just need the XID part of the next transaction ID.
  */
 static inline TransactionId
-ReadNewTransactionId(void)
+ReadNextTransactionId(void)
 {
    return XidFromFullTransactionId(ReadNextFullTransactionId());
 }