Skip to content

Commit c7ecd6a

Browse files
committed
ReadNewTransactionId() -> ReadNextTransactionId().
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 <pg@bowt.ie> Discussion: https://postgr.es/m/CAH2-WzmVR4SakBXQUdhhPpMf1aYvZCnna5%3DHKa7DAgEmBAg%2B8g%40mail.gmail.com
1 parent 8facf1e commit c7ecd6a

File tree

7 files changed

+14
-14
lines changed

7 files changed

+14
-14
lines changed

src/backend/access/gin/ginvacuum.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ ginDeletePage(GinVacuumState *gvs, BlockNumber deleteBlkno, BlockNumber leftBlkn
189189
* address.
190190
*/
191191
GinPageSetDeleted(page);
192-
GinPageSetDeleteXid(page, ReadNewTransactionId());
192+
GinPageSetDeleteXid(page, ReadNextTransactionId());
193193

194194
MarkBufferDirty(pBuffer);
195195
MarkBufferDirty(lBuffer);

src/backend/access/nbtree/nbtpage.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2266,7 +2266,7 @@ _bt_mark_page_halfdead(Relation rel, Buffer leafbuf, BTStack stack)
22662266
*
22672267
* We maintain *oldestBtpoXact for pages that are deleted by the current
22682268
* VACUUM operation here. This must be handled here because we conservatively
2269-
* assume that there needs to be a new call to ReadNewTransactionId() each
2269+
* assume that there needs to be a new call to ReadNextTransactionId() each
22702270
* time a page gets deleted. See comments about the underlying assumption
22712271
* below.
22722272
*
@@ -2559,7 +2559,7 @@ _bt_unlink_halfdead_page(Relation rel, Buffer leafbuf, BlockNumber scanblkno,
25592559
* Mark the page itself deleted. It can be recycled when all current
25602560
* transactions are gone. Storing GetTopTransactionId() would work, but
25612561
* we're in VACUUM and would not otherwise have an XID. Having already
2562-
* updated links to the target, ReadNewTransactionId() suffices as an
2562+
* updated links to the target, ReadNextTransactionId() suffices as an
25632563
* upper bound. Any scan having retained a now-stale link is advertising
25642564
* in its PGPROC an xmin less than or equal to the value we read here. It
25652565
* 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,
25702570
Assert(P_ISHALFDEAD(opaque) || !P_ISLEAF(opaque));
25712571
opaque->btpo_flags &= ~BTP_HALF_DEAD;
25722572
opaque->btpo_flags |= BTP_DELETED;
2573-
opaque->btpo.xact = ReadNewTransactionId();
2573+
opaque->btpo.xact = ReadNextTransactionId();
25742574

25752575
/*
25762576
* Remove the remaining tuples on the page. This keeps things simple for

src/backend/access/transam/commit_ts.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,7 @@ ActivateCommitTs(void)
733733
if (ShmemVariableCache->oldestCommitTsXid == InvalidTransactionId)
734734
{
735735
ShmemVariableCache->oldestCommitTsXid =
736-
ShmemVariableCache->newestCommitTsXid = ReadNewTransactionId();
736+
ShmemVariableCache->newestCommitTsXid = ReadNextTransactionId();
737737
}
738738
LWLockRelease(CommitTsLock);
739739

src/backend/access/transam/xact.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ GetStableLatestTransactionId(void)
548548
lxid = MyProc->lxid;
549549
stablexid = GetTopTransactionIdIfAny();
550550
if (!TransactionIdIsValid(stablexid))
551-
stablexid = ReadNewTransactionId();
551+
stablexid = ReadNextTransactionId();
552552
}
553553

554554
Assert(TransactionIdIsValid(stablexid));

src/backend/commands/vacuum.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1014,7 +1014,7 @@ vacuum_set_xid_limits(Relation rel,
10141014
* autovacuum_freeze_max_age / 2 XIDs old), complain and force a minimum
10151015
* freeze age of zero.
10161016
*/
1017-
safeLimit = ReadNewTransactionId() - autovacuum_freeze_max_age;
1017+
safeLimit = ReadNextTransactionId() - autovacuum_freeze_max_age;
10181018
if (!TransactionIdIsNormal(safeLimit))
10191019
safeLimit = FirstNormalTransactionId;
10201020

@@ -1097,7 +1097,7 @@ vacuum_set_xid_limits(Relation rel,
10971097
* Compute XID limit causing a full-table vacuum, being careful not to
10981098
* generate a "permanent" XID.
10991099
*/
1100-
limit = ReadNewTransactionId() - freezetable;
1100+
limit = ReadNextTransactionId() - freezetable;
11011101
if (!TransactionIdIsNormal(limit))
11021102
limit = FirstNormalTransactionId;
11031103

@@ -1314,7 +1314,7 @@ vac_update_relstats(Relation relation,
13141314
if (TransactionIdIsNormal(frozenxid) &&
13151315
pgcform->relfrozenxid != frozenxid &&
13161316
(TransactionIdPrecedes(pgcform->relfrozenxid, frozenxid) ||
1317-
TransactionIdPrecedes(ReadNewTransactionId(),
1317+
TransactionIdPrecedes(ReadNextTransactionId(),
13181318
pgcform->relfrozenxid)))
13191319
{
13201320
pgcform->relfrozenxid = frozenxid;
@@ -1401,7 +1401,7 @@ vac_update_datfrozenxid(void)
14011401
* validly see during the scan. These are conservative values, but it's
14021402
* not really worth trying to be more exact.
14031403
*/
1404-
lastSaneFrozenXid = ReadNewTransactionId();
1404+
lastSaneFrozenXid = ReadNextTransactionId();
14051405
lastSaneMinMulti = ReadNextMultiXactId();
14061406

14071407
/*
@@ -1577,7 +1577,7 @@ vac_truncate_clog(TransactionId frozenXID,
15771577
TransactionId lastSaneFrozenXid,
15781578
MultiXactId lastSaneMinMulti)
15791579
{
1580-
TransactionId nextXID = ReadNewTransactionId();
1580+
TransactionId nextXID = ReadNextTransactionId();
15811581
Relation relation;
15821582
TableScanDesc scan;
15831583
HeapTuple tuple;

src/backend/postmaster/autovacuum.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1190,7 +1190,7 @@ do_start_worker(void)
11901190
* pass without forcing a vacuum. (This limit can be tightened for
11911191
* particular tables, but not loosened.)
11921192
*/
1193-
recentXid = ReadNewTransactionId();
1193+
recentXid = ReadNextTransactionId();
11941194
xidForceLimit = recentXid - autovacuum_freeze_max_age;
11951195
/* ensure it's a "normal" XID, else TransactionIdPrecedes misbehaves */
11961196
/* this can cause the limit to go backwards by 3, but that's OK */
@@ -1709,7 +1709,7 @@ AutoVacWorkerMain(int argc, char *argv[])
17091709
pg_usleep(PostAuthDelay * 1000000L);
17101710

17111711
/* And do an appropriate amount of work */
1712-
recentXid = ReadNewTransactionId();
1712+
recentXid = ReadNextTransactionId();
17131713
recentMulti = ReadNextMultiXactId();
17141714
do_autovacuum();
17151715
}

src/include/access/transam.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ extern void AssertTransactionIdInAllowableRange(TransactionId xid);
305305
* For callers that just need the XID part of the next transaction ID.
306306
*/
307307
static inline TransactionId
308-
ReadNewTransactionId(void)
308+
ReadNextTransactionId(void)
309309
{
310310
return XidFromFullTransactionId(ReadNextFullTransactionId());
311311
}

0 commit comments

Comments
 (0)