From fea10a64340e529805609126740a540c8f9daab4 Mon Sep 17 00:00:00 2001 From: Andres Freund Date: Tue, 11 Aug 2020 11:25:23 -0700 Subject: [PATCH] Rename VariableCacheData.nextFullXid to nextXid. Including Full in variable names duplicates the type information and leads to overly long names. As FullTransactionId cannot accidentally be casted to TransactionId that does not seem necessary. Author: Andres Freund Discussion: https://postgr.es/m/20200724011143.jccsyvsvymuiqfxu@alap3.anarazel.de --- src/backend/access/gist/gistxlog.c | 6 ++-- src/backend/access/rmgrdesc/xlogdesc.c | 4 +-- src/backend/access/transam/clog.c | 8 ++--- src/backend/access/transam/commit_ts.c | 4 +-- src/backend/access/transam/multixact.c | 2 +- src/backend/access/transam/subtrans.c | 10 +++--- src/backend/access/transam/twophase.c | 22 ++++++------ src/backend/access/transam/varsup.c | 26 +++++++------- src/backend/access/transam/xact.c | 4 +-- src/backend/access/transam/xlog.c | 48 ++++++++++++------------- src/backend/access/transam/xlogreader.c | 4 +-- src/backend/storage/ipc/procarray.c | 14 ++++---- src/backend/storage/ipc/standby.c | 2 +- src/backend/storage/lmgr/predicate.c | 2 +- src/backend/utils/misc/pg_controldata.c | 4 +-- src/bin/pg_controldata/pg_controldata.c | 4 +-- src/bin/pg_resetwal/pg_resetwal.c | 18 +++++----- src/include/access/transam.h | 4 +-- src/include/catalog/pg_control.h | 2 +- src/include/storage/standby.h | 2 +- src/include/storage/standbydefs.h | 2 +- 21 files changed, 96 insertions(+), 96 deletions(-) diff --git a/src/backend/access/gist/gistxlog.c b/src/backend/access/gist/gistxlog.c index 3f0effd5e4..7b5d1e98b7 100644 --- a/src/backend/access/gist/gistxlog.c +++ b/src/backend/access/gist/gistxlog.c @@ -396,7 +396,7 @@ gistRedoPageReuse(XLogReaderState *record) if (InHotStandby) { FullTransactionId latestRemovedFullXid = xlrec->latestRemovedFullXid; - FullTransactionId nextFullXid = ReadNextFullTransactionId(); + FullTransactionId nextXid = ReadNextFullTransactionId(); uint64 diff; /* @@ -405,8 +405,8 @@ gistRedoPageReuse(XLogReaderState *record) * logged value is very old, so that XID wrap-around already happened * on it, there can't be any snapshots that still see it. */ - nextFullXid = ReadNextFullTransactionId(); - diff = U64FromFullTransactionId(nextFullXid) - + nextXid = ReadNextFullTransactionId(); + diff = U64FromFullTransactionId(nextXid) - U64FromFullTransactionId(latestRemovedFullXid); if (diff < MaxTransactionId / 2) { diff --git a/src/backend/access/rmgrdesc/xlogdesc.c b/src/backend/access/rmgrdesc/xlogdesc.c index 1cd97852e8..3200f777f5 100644 --- a/src/backend/access/rmgrdesc/xlogdesc.c +++ b/src/backend/access/rmgrdesc/xlogdesc.c @@ -53,8 +53,8 @@ xlog_desc(StringInfo buf, XLogReaderState *record) checkpoint->ThisTimeLineID, checkpoint->PrevTimeLineID, checkpoint->fullPageWrites ? "true" : "false", - EpochFromFullTransactionId(checkpoint->nextFullXid), - XidFromFullTransactionId(checkpoint->nextFullXid), + EpochFromFullTransactionId(checkpoint->nextXid), + XidFromFullTransactionId(checkpoint->nextXid), checkpoint->nextOid, checkpoint->nextMulti, checkpoint->nextMultiOffset, diff --git a/src/backend/access/transam/clog.c b/src/backend/access/transam/clog.c index f3da40ae01..dd2f4d5bc7 100644 --- a/src/backend/access/transam/clog.c +++ b/src/backend/access/transam/clog.c @@ -742,12 +742,12 @@ ZeroCLOGPage(int pageno, bool writeXlog) /* * This must be called ONCE during postmaster or standalone-backend startup, - * after StartupXLOG has initialized ShmemVariableCache->nextFullXid. + * after StartupXLOG has initialized ShmemVariableCache->nextXid. */ void StartupCLOG(void) { - TransactionId xid = XidFromFullTransactionId(ShmemVariableCache->nextFullXid); + TransactionId xid = XidFromFullTransactionId(ShmemVariableCache->nextXid); int pageno = TransactionIdToPage(xid); LWLockAcquire(XactSLRULock, LW_EXCLUSIVE); @@ -766,7 +766,7 @@ StartupCLOG(void) void TrimCLOG(void) { - TransactionId xid = XidFromFullTransactionId(ShmemVariableCache->nextFullXid); + TransactionId xid = XidFromFullTransactionId(ShmemVariableCache->nextXid); int pageno = TransactionIdToPage(xid); LWLockAcquire(XactSLRULock, LW_EXCLUSIVE); @@ -785,7 +785,7 @@ TrimCLOG(void) * but makes no WAL entry). Let's just be safe. (We need not worry about * pages beyond the current one, since those will be zeroed when first * used. For the same reason, there is no need to do anything when - * nextFullXid is exactly at a page boundary; and it's likely that the + * nextXid is exactly at a page boundary; and it's likely that the * "current" page doesn't exist yet in that case.) */ if (TransactionIdToPgIndex(xid) != 0) diff --git a/src/backend/access/transam/commit_ts.c b/src/backend/access/transam/commit_ts.c index 903280ae92..5244b06a2b 100644 --- a/src/backend/access/transam/commit_ts.c +++ b/src/backend/access/transam/commit_ts.c @@ -614,7 +614,7 @@ ZeroCommitTsPage(int pageno, bool writeXlog) /* * This must be called ONCE during postmaster or standalone-backend startup, - * after StartupXLOG has initialized ShmemVariableCache->nextFullXid. + * after StartupXLOG has initialized ShmemVariableCache->nextXid. */ void StartupCommitTs(void) @@ -704,7 +704,7 @@ ActivateCommitTs(void) } LWLockRelease(CommitTsLock); - xid = XidFromFullTransactionId(ShmemVariableCache->nextFullXid); + xid = XidFromFullTransactionId(ShmemVariableCache->nextXid); pageno = TransactionIdToCTsPage(xid); /* diff --git a/src/backend/access/transam/multixact.c b/src/backend/access/transam/multixact.c index 475f5ed861..b8bedca04a 100644 --- a/src/backend/access/transam/multixact.c +++ b/src/backend/access/transam/multixact.c @@ -3265,7 +3265,7 @@ multixact_redo(XLogReaderState *record) xlrec->moff + xlrec->nmembers); /* - * Make sure nextFullXid is beyond any XID mentioned in the record. + * Make sure nextXid is beyond any XID mentioned in the record. * This should be unnecessary, since any XID found here ought to have * other evidence in the XLOG, but let's be safe. */ diff --git a/src/backend/access/transam/subtrans.c b/src/backend/access/transam/subtrans.c index f33ae407a6..a087a55542 100644 --- a/src/backend/access/transam/subtrans.c +++ b/src/backend/access/transam/subtrans.c @@ -241,15 +241,15 @@ ZeroSUBTRANSPage(int pageno) /* * This must be called ONCE during postmaster or standalone-backend startup, - * after StartupXLOG has initialized ShmemVariableCache->nextFullXid. + * after StartupXLOG has initialized ShmemVariableCache->nextXid. * - * oldestActiveXID is the oldest XID of any prepared transaction, or nextFullXid + * oldestActiveXID is the oldest XID of any prepared transaction, or nextXid * if there are none. */ void StartupSUBTRANS(TransactionId oldestActiveXID) { - FullTransactionId nextFullXid; + FullTransactionId nextXid; int startPage; int endPage; @@ -262,8 +262,8 @@ StartupSUBTRANS(TransactionId oldestActiveXID) LWLockAcquire(SubtransSLRULock, LW_EXCLUSIVE); startPage = TransactionIdToPage(oldestActiveXID); - nextFullXid = ShmemVariableCache->nextFullXid; - endPage = TransactionIdToPage(XidFromFullTransactionId(nextFullXid)); + nextXid = ShmemVariableCache->nextXid; + endPage = TransactionIdToPage(XidFromFullTransactionId(nextXid)); while (startPage != endPage) { diff --git a/src/backend/access/transam/twophase.c b/src/backend/access/transam/twophase.c index 9b2e59bf0e..31f135f5ce 100644 --- a/src/backend/access/transam/twophase.c +++ b/src/backend/access/transam/twophase.c @@ -1813,16 +1813,16 @@ restoreTwoPhaseData(void) * * Scan the shared memory entries of TwoPhaseState and determine the range * of valid XIDs present. This is run during database startup, after we - * have completed reading WAL. ShmemVariableCache->nextFullXid has been set to + * have completed reading WAL. ShmemVariableCache->nextXid has been set to * one more than the highest XID for which evidence exists in WAL. * - * We throw away any prepared xacts with main XID beyond nextFullXid --- if any + * We throw away any prepared xacts with main XID beyond nextXid --- if any * are present, it suggests that the DBA has done a PITR recovery to an * earlier point in time without cleaning out pg_twophase. We dare not * try to recover such prepared xacts since they likely depend on database * state that doesn't exist now. * - * However, we will advance nextFullXid beyond any subxact XIDs belonging to + * However, we will advance nextXid beyond any subxact XIDs belonging to * valid prepared xacts. We need to do this since subxact commit doesn't * write a WAL entry, and so there might be no evidence in WAL of those * subxact XIDs. @@ -1832,7 +1832,7 @@ restoreTwoPhaseData(void) * backup should be rolled in. * * Our other responsibility is to determine and return the oldest valid XID - * among the prepared xacts (if none, return ShmemVariableCache->nextFullXid). + * among the prepared xacts (if none, return ShmemVariableCache->nextXid). * This is needed to synchronize pg_subtrans startup properly. * * If xids_p and nxids_p are not NULL, pointer to a palloc'd array of all @@ -1842,8 +1842,8 @@ restoreTwoPhaseData(void) TransactionId PrescanPreparedTransactions(TransactionId **xids_p, int *nxids_p) { - FullTransactionId nextFullXid = ShmemVariableCache->nextFullXid; - TransactionId origNextXid = XidFromFullTransactionId(nextFullXid); + FullTransactionId nextXid = ShmemVariableCache->nextXid; + TransactionId origNextXid = XidFromFullTransactionId(nextXid); TransactionId result = origNextXid; TransactionId *xids = NULL; int nxids = 0; @@ -2059,7 +2059,7 @@ RecoverPreparedTransactions(void) * * If setParent is true, set up subtransaction parent linkages. * - * If setNextXid is true, set ShmemVariableCache->nextFullXid to the newest + * If setNextXid is true, set ShmemVariableCache->nextXid to the newest * value scanned. */ static char * @@ -2068,8 +2068,8 @@ ProcessTwoPhaseBuffer(TransactionId xid, bool fromdisk, bool setParent, bool setNextXid) { - FullTransactionId nextFullXid = ShmemVariableCache->nextFullXid; - TransactionId origNextXid = XidFromFullTransactionId(nextFullXid); + FullTransactionId nextXid = ShmemVariableCache->nextXid; + TransactionId origNextXid = XidFromFullTransactionId(nextXid); TransactionId *subxids; char *buf; TwoPhaseFileHeader *hdr; @@ -2149,7 +2149,7 @@ ProcessTwoPhaseBuffer(TransactionId xid, /* * Examine subtransaction XIDs ... they should all follow main XID, and - * they may force us to advance nextFullXid. + * they may force us to advance nextXid. */ subxids = (TransactionId *) (buf + MAXALIGN(sizeof(TwoPhaseFileHeader)) + @@ -2160,7 +2160,7 @@ ProcessTwoPhaseBuffer(TransactionId xid, Assert(TransactionIdFollows(subxid, xid)); - /* update nextFullXid if needed */ + /* update nextXid if needed */ if (setNextXid) AdvanceNextFullTransactionIdPastXid(subxid); diff --git a/src/backend/access/transam/varsup.c b/src/backend/access/transam/varsup.c index 0142bc70f6..3ebd75118f 100644 --- a/src/backend/access/transam/varsup.c +++ b/src/backend/access/transam/varsup.c @@ -75,7 +75,7 @@ GetNewTransactionId(bool isSubXact) LWLockAcquire(XidGenLock, LW_EXCLUSIVE); - full_xid = ShmemVariableCache->nextFullXid; + full_xid = ShmemVariableCache->nextXid; xid = XidFromFullTransactionId(full_xid); /*---------- @@ -159,7 +159,7 @@ GetNewTransactionId(bool isSubXact) /* Re-acquire lock and start over */ LWLockAcquire(XidGenLock, LW_EXCLUSIVE); - full_xid = ShmemVariableCache->nextFullXid; + full_xid = ShmemVariableCache->nextXid; xid = XidFromFullTransactionId(full_xid); } @@ -177,12 +177,12 @@ GetNewTransactionId(bool isSubXact) ExtendSUBTRANS(xid); /* - * Now advance the nextFullXid counter. This must not happen until after + * Now advance the nextXid counter. This must not happen until after * we have successfully completed ExtendCLOG() --- if that routine fails, * we want the next incoming transaction to try it again. We cannot * assign more XIDs until there is CLOG space for them. */ - FullTransactionIdAdvance(&ShmemVariableCache->nextFullXid); + FullTransactionIdAdvance(&ShmemVariableCache->nextXid); /* * We must store the new XID into the shared ProcArray before releasing @@ -240,7 +240,7 @@ GetNewTransactionId(bool isSubXact) } /* - * Read nextFullXid but don't allocate it. + * Read nextXid but don't allocate it. */ FullTransactionId ReadNextFullTransactionId(void) @@ -248,14 +248,14 @@ ReadNextFullTransactionId(void) FullTransactionId fullXid; LWLockAcquire(XidGenLock, LW_SHARED); - fullXid = ShmemVariableCache->nextFullXid; + fullXid = ShmemVariableCache->nextXid; LWLockRelease(XidGenLock); return fullXid; } /* - * Advance nextFullXid to the value after a given xid. The epoch is inferred. + * Advance nextXid to the value after a given xid. The epoch is inferred. * This must only be called during recovery or from two-phase start-up code. */ void @@ -266,14 +266,14 @@ AdvanceNextFullTransactionIdPastXid(TransactionId xid) uint32 epoch; /* - * It is safe to read nextFullXid without a lock, because this is only + * It is safe to read nextXid without a lock, because this is only * called from the startup process or single-process mode, meaning that no * other process can modify it. */ Assert(AmStartupProcess() || !IsUnderPostmaster); /* Fast return if this isn't an xid high enough to move the needle. */ - next_xid = XidFromFullTransactionId(ShmemVariableCache->nextFullXid); + next_xid = XidFromFullTransactionId(ShmemVariableCache->nextXid); if (!TransactionIdFollowsOrEquals(xid, next_xid)) return; @@ -286,7 +286,7 @@ AdvanceNextFullTransactionIdPastXid(TransactionId xid) * point in the WAL stream. */ TransactionIdAdvance(xid); - epoch = EpochFromFullTransactionId(ShmemVariableCache->nextFullXid); + epoch = EpochFromFullTransactionId(ShmemVariableCache->nextXid); if (unlikely(xid < next_xid)) ++epoch; newNextFullXid = FullTransactionIdFromEpochAndXid(epoch, xid); @@ -296,7 +296,7 @@ AdvanceNextFullTransactionIdPastXid(TransactionId xid) * concurrent readers. */ LWLockAcquire(XidGenLock, LW_EXCLUSIVE); - ShmemVariableCache->nextFullXid = newNextFullXid; + ShmemVariableCache->nextXid = newNextFullXid; LWLockRelease(XidGenLock); } @@ -404,7 +404,7 @@ SetTransactionIdLimit(TransactionId oldest_datfrozenxid, Oid oldest_datoid) ShmemVariableCache->xidStopLimit = xidStopLimit; ShmemVariableCache->xidWrapLimit = xidWrapLimit; ShmemVariableCache->oldestXidDB = oldest_datoid; - curXid = XidFromFullTransactionId(ShmemVariableCache->nextFullXid); + curXid = XidFromFullTransactionId(ShmemVariableCache->nextXid); LWLockRelease(XidGenLock); /* Log the info */ @@ -480,7 +480,7 @@ ForceTransactionIdLimitUpdate(void) /* Locking is probably not really necessary, but let's be careful */ LWLockAcquire(XidGenLock, LW_SHARED); - nextXid = XidFromFullTransactionId(ShmemVariableCache->nextFullXid); + nextXid = XidFromFullTransactionId(ShmemVariableCache->nextXid); xidVacLimit = ShmemVariableCache->xidVacLimit; oldestXid = ShmemVariableCache->oldestXid; oldestXidDB = ShmemVariableCache->oldestXidDB; diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c index 727d616035..7ccb7d68ed 100644 --- a/src/backend/access/transam/xact.c +++ b/src/backend/access/transam/xact.c @@ -5791,7 +5791,7 @@ xact_redo_commit(xl_xact_parsed_commit *parsed, max_xid = TransactionIdLatest(xid, parsed->nsubxacts, parsed->subxacts); - /* Make sure nextFullXid is beyond any XID mentioned in the record. */ + /* Make sure nextXid is beyond any XID mentioned in the record. */ AdvanceNextFullTransactionIdPastXid(max_xid); Assert(((parsed->xinfo & XACT_XINFO_HAS_ORIGIN) == 0) == @@ -5931,7 +5931,7 @@ xact_redo_abort(xl_xact_parsed_abort *parsed, TransactionId xid) Assert(TransactionIdIsValid(xid)); - /* Make sure nextFullXid is beyond any XID mentioned in the record. */ + /* Make sure nextXid is beyond any XID mentioned in the record. */ max_xid = TransactionIdLatest(xid, parsed->nsubxacts, parsed->subxacts); diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 756b838e6a..53945c0e30 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -601,7 +601,7 @@ typedef struct XLogCtlData /* Protected by info_lck: */ XLogwrtRqst LogwrtRqst; XLogRecPtr RedoRecPtr; /* a recent copy of Insert->RedoRecPtr */ - FullTransactionId ckptFullXid; /* nextFullXid of latest checkpoint */ + FullTransactionId ckptFullXid; /* nextXid of latest checkpoint */ XLogRecPtr asyncXactLSN; /* LSN of newest async commit/abort */ XLogRecPtr replicationSlotMinLSN; /* oldest LSN needed by any slot */ @@ -5239,7 +5239,7 @@ BootStrapXLOG(void) checkPoint.ThisTimeLineID = ThisTimeLineID; checkPoint.PrevTimeLineID = ThisTimeLineID; checkPoint.fullPageWrites = fullPageWrites; - checkPoint.nextFullXid = + checkPoint.nextXid = FullTransactionIdFromEpochAndXid(0, FirstNormalTransactionId); checkPoint.nextOid = FirstBootstrapObjectId; checkPoint.nextMulti = FirstMultiXactId; @@ -5253,7 +5253,7 @@ BootStrapXLOG(void) checkPoint.time = (pg_time_t) time(NULL); checkPoint.oldestActiveXid = InvalidTransactionId; - ShmemVariableCache->nextFullXid = checkPoint.nextFullXid; + ShmemVariableCache->nextXid = checkPoint.nextXid; ShmemVariableCache->nextOid = checkPoint.nextOid; ShmemVariableCache->oidCount = 0; MultiXactSetNextMXact(checkPoint.nextMulti, checkPoint.nextMultiOffset); @@ -6741,7 +6741,7 @@ StartupXLOG(void) wasShutdown ? "true" : "false"))); ereport(DEBUG1, (errmsg_internal("next transaction ID: " UINT64_FORMAT "; next OID: %u", - U64FromFullTransactionId(checkPoint.nextFullXid), + U64FromFullTransactionId(checkPoint.nextXid), checkPoint.nextOid))); ereport(DEBUG1, (errmsg_internal("next MultiXactId: %u; next MultiXactOffset: %u", @@ -6756,12 +6756,12 @@ StartupXLOG(void) (errmsg_internal("commit timestamp Xid oldest/newest: %u/%u", checkPoint.oldestCommitTsXid, checkPoint.newestCommitTsXid))); - if (!TransactionIdIsNormal(XidFromFullTransactionId(checkPoint.nextFullXid))) + if (!TransactionIdIsNormal(XidFromFullTransactionId(checkPoint.nextXid))) ereport(PANIC, (errmsg("invalid next transaction ID"))); /* initialize shared memory variables from the checkpoint record */ - ShmemVariableCache->nextFullXid = checkPoint.nextFullXid; + ShmemVariableCache->nextXid = checkPoint.nextXid; ShmemVariableCache->nextOid = checkPoint.nextOid; ShmemVariableCache->oidCount = 0; MultiXactSetNextMXact(checkPoint.nextMulti, checkPoint.nextMultiOffset); @@ -6770,7 +6770,7 @@ StartupXLOG(void) SetMultiXactIdLimit(checkPoint.oldestMulti, checkPoint.oldestMultiDB, true); SetCommitTsLimit(checkPoint.oldestCommitTsXid, checkPoint.newestCommitTsXid); - XLogCtl->ckptFullXid = checkPoint.nextFullXid; + XLogCtl->ckptFullXid = checkPoint.nextXid; /* * Initialize replication slots, before there's a chance to remove @@ -7051,7 +7051,7 @@ StartupXLOG(void) Assert(TransactionIdIsValid(oldestActiveXID)); /* Tell procarray about the range of xids it has to deal with */ - ProcArrayInitRecovery(XidFromFullTransactionId(ShmemVariableCache->nextFullXid)); + ProcArrayInitRecovery(XidFromFullTransactionId(ShmemVariableCache->nextXid)); /* * Startup commit log and subtrans only. MultiXact and commit @@ -7081,9 +7081,9 @@ StartupXLOG(void) running.xcnt = nxids; running.subxcnt = 0; running.subxid_overflow = false; - running.nextXid = XidFromFullTransactionId(checkPoint.nextFullXid); + running.nextXid = XidFromFullTransactionId(checkPoint.nextXid); running.oldestRunningXid = oldestActiveXID; - latestCompletedXid = XidFromFullTransactionId(checkPoint.nextFullXid); + latestCompletedXid = XidFromFullTransactionId(checkPoint.nextXid); TransactionIdRetreat(latestCompletedXid); Assert(TransactionIdIsNormal(latestCompletedXid)); running.latestCompletedXid = latestCompletedXid; @@ -7254,7 +7254,7 @@ StartupXLOG(void) error_context_stack = &errcallback; /* - * ShmemVariableCache->nextFullXid must be beyond record's + * ShmemVariableCache->nextXid must be beyond record's * xid. */ AdvanceNextFullTransactionIdPastXid(record->xl_xid); @@ -7865,7 +7865,7 @@ StartupXLOG(void) /* also initialize latestCompletedXid, to nextXid - 1 */ LWLockAcquire(ProcArrayLock, LW_EXCLUSIVE); - ShmemVariableCache->latestCompletedXid = XidFromFullTransactionId(ShmemVariableCache->nextFullXid); + ShmemVariableCache->latestCompletedXid = XidFromFullTransactionId(ShmemVariableCache->nextXid); TransactionIdRetreat(ShmemVariableCache->latestCompletedXid); LWLockRelease(ProcArrayLock); @@ -8897,7 +8897,7 @@ CreateCheckPoint(int flags) * there. */ LWLockAcquire(XidGenLock, LW_SHARED); - checkPoint.nextFullXid = ShmemVariableCache->nextFullXid; + checkPoint.nextXid = ShmemVariableCache->nextXid; checkPoint.oldestXid = ShmemVariableCache->oldestXid; checkPoint.oldestXidDB = ShmemVariableCache->oldestXidDB; LWLockRelease(XidGenLock); @@ -9050,7 +9050,7 @@ CreateCheckPoint(int flags) /* Update shared-memory copy of checkpoint XID/epoch */ SpinLockAcquire(&XLogCtl->info_lck); - XLogCtl->ckptFullXid = checkPoint.nextFullXid; + XLogCtl->ckptFullXid = checkPoint.nextXid; SpinLockRelease(&XLogCtl->info_lck); /* @@ -9926,7 +9926,7 @@ xlog_redo(XLogReaderState *record) memcpy(&checkPoint, XLogRecGetData(record), sizeof(CheckPoint)); /* In a SHUTDOWN checkpoint, believe the counters exactly */ LWLockAcquire(XidGenLock, LW_EXCLUSIVE); - ShmemVariableCache->nextFullXid = checkPoint.nextFullXid; + ShmemVariableCache->nextXid = checkPoint.nextXid; LWLockRelease(XidGenLock); LWLockAcquire(OidGenLock, LW_EXCLUSIVE); ShmemVariableCache->nextOid = checkPoint.nextOid; @@ -9980,9 +9980,9 @@ xlog_redo(XLogReaderState *record) running.xcnt = nxids; running.subxcnt = 0; running.subxid_overflow = false; - running.nextXid = XidFromFullTransactionId(checkPoint.nextFullXid); + running.nextXid = XidFromFullTransactionId(checkPoint.nextXid); running.oldestRunningXid = oldestActiveXID; - latestCompletedXid = XidFromFullTransactionId(checkPoint.nextFullXid); + latestCompletedXid = XidFromFullTransactionId(checkPoint.nextXid); TransactionIdRetreat(latestCompletedXid); Assert(TransactionIdIsNormal(latestCompletedXid)); running.latestCompletedXid = latestCompletedXid; @@ -9995,12 +9995,12 @@ xlog_redo(XLogReaderState *record) /* ControlFile->checkPointCopy always tracks the latest ckpt XID */ LWLockAcquire(ControlFileLock, LW_EXCLUSIVE); - ControlFile->checkPointCopy.nextFullXid = checkPoint.nextFullXid; + ControlFile->checkPointCopy.nextXid = checkPoint.nextXid; LWLockRelease(ControlFileLock); /* Update shared-memory copy of checkpoint XID/epoch */ SpinLockAcquire(&XLogCtl->info_lck); - XLogCtl->ckptFullXid = checkPoint.nextFullXid; + XLogCtl->ckptFullXid = checkPoint.nextXid; SpinLockRelease(&XLogCtl->info_lck); /* @@ -10021,9 +10021,9 @@ xlog_redo(XLogReaderState *record) memcpy(&checkPoint, XLogRecGetData(record), sizeof(CheckPoint)); /* In an ONLINE checkpoint, treat the XID counter as a minimum */ LWLockAcquire(XidGenLock, LW_EXCLUSIVE); - if (FullTransactionIdPrecedes(ShmemVariableCache->nextFullXid, - checkPoint.nextFullXid)) - ShmemVariableCache->nextFullXid = checkPoint.nextFullXid; + if (FullTransactionIdPrecedes(ShmemVariableCache->nextXid, + checkPoint.nextXid)) + ShmemVariableCache->nextXid = checkPoint.nextXid; LWLockRelease(XidGenLock); /* @@ -10054,12 +10054,12 @@ xlog_redo(XLogReaderState *record) checkPoint.oldestXidDB); /* ControlFile->checkPointCopy always tracks the latest ckpt XID */ LWLockAcquire(ControlFileLock, LW_EXCLUSIVE); - ControlFile->checkPointCopy.nextFullXid = checkPoint.nextFullXid; + ControlFile->checkPointCopy.nextXid = checkPoint.nextXid; LWLockRelease(ControlFileLock); /* Update shared-memory copy of checkpoint XID/epoch */ SpinLockAcquire(&XLogCtl->info_lck); - XLogCtl->ckptFullXid = checkPoint.nextFullXid; + XLogCtl->ckptFullXid = checkPoint.nextXid; SpinLockRelease(&XLogCtl->info_lck); /* TLI should not change in an on-line checkpoint */ diff --git a/src/backend/access/transam/xlogreader.c b/src/backend/access/transam/xlogreader.c index a757baccfc..67996018da 100644 --- a/src/backend/access/transam/xlogreader.c +++ b/src/backend/access/transam/xlogreader.c @@ -1613,8 +1613,8 @@ XLogRecGetFullXid(XLogReaderState *record) Assert(AmStartupProcess() || !IsUnderPostmaster); xid = XLogRecGetXid(record); - next_xid = XidFromFullTransactionId(ShmemVariableCache->nextFullXid); - epoch = EpochFromFullTransactionId(ShmemVariableCache->nextFullXid); + next_xid = XidFromFullTransactionId(ShmemVariableCache->nextXid); + epoch = EpochFromFullTransactionId(ShmemVariableCache->nextXid); /* * If xid is numerically greater than next_xid, it has to be from the last diff --git a/src/backend/storage/ipc/procarray.c b/src/backend/storage/ipc/procarray.c index b448533564..be0240e0dd 100644 --- a/src/backend/storage/ipc/procarray.c +++ b/src/backend/storage/ipc/procarray.c @@ -878,10 +878,10 @@ ProcArrayApplyRecoveryInfo(RunningTransactions running) LWLockRelease(ProcArrayLock); - /* ShmemVariableCache->nextFullXid must be beyond any observed xid. */ + /* ShmemVariableCache->nextXid must be beyond any observed xid. */ AdvanceNextFullTransactionIdPastXid(latestObservedXid); - Assert(FullTransactionIdIsValid(ShmemVariableCache->nextFullXid)); + Assert(FullTransactionIdIsValid(ShmemVariableCache->nextXid)); KnownAssignedXidsDisplay(trace_recovery(DEBUG3)); if (standbyState == STANDBY_SNAPSHOT_READY) @@ -1986,7 +1986,7 @@ GetRunningTransactionData(void) latestCompletedXid = ShmemVariableCache->latestCompletedXid; - oldestRunningXid = XidFromFullTransactionId(ShmemVariableCache->nextFullXid); + oldestRunningXid = XidFromFullTransactionId(ShmemVariableCache->nextXid); /* * Spin over procArray collecting all xids @@ -2078,7 +2078,7 @@ GetRunningTransactionData(void) CurrentRunningXacts->xcnt = count - subcount; CurrentRunningXacts->subxcnt = subcount; CurrentRunningXacts->subxid_overflow = suboverflowed; - CurrentRunningXacts->nextXid = XidFromFullTransactionId(ShmemVariableCache->nextFullXid); + CurrentRunningXacts->nextXid = XidFromFullTransactionId(ShmemVariableCache->nextXid); CurrentRunningXacts->oldestRunningXid = oldestRunningXid; CurrentRunningXacts->latestCompletedXid = latestCompletedXid; @@ -2123,7 +2123,7 @@ GetOldestActiveTransactionId(void) * have already completed), when we spin over it. */ LWLockAcquire(XidGenLock, LW_SHARED); - oldestRunningXid = XidFromFullTransactionId(ShmemVariableCache->nextFullXid); + oldestRunningXid = XidFromFullTransactionId(ShmemVariableCache->nextXid); LWLockRelease(XidGenLock); /* @@ -2191,7 +2191,7 @@ GetOldestSafeDecodingTransactionId(bool catalogOnly) * a safe, albeit pessimal, value. */ LWLockAcquire(XidGenLock, LW_SHARED); - oldestSafeXid = XidFromFullTransactionId(ShmemVariableCache->nextFullXid); + oldestSafeXid = XidFromFullTransactionId(ShmemVariableCache->nextXid); /* * If there's already a slot pegging the xmin horizon, we can start with @@ -3361,7 +3361,7 @@ RecordKnownAssignedTransactionIds(TransactionId xid) */ latestObservedXid = xid; - /* ShmemVariableCache->nextFullXid must be beyond any observed xid */ + /* ShmemVariableCache->nextXid must be beyond any observed xid */ AdvanceNextFullTransactionIdPastXid(latestObservedXid); next_expected_xid = latestObservedXid; TransactionIdAdvance(next_expected_xid); diff --git a/src/backend/storage/ipc/standby.c b/src/backend/storage/ipc/standby.c index f5229839cf..52b2809dac 100644 --- a/src/backend/storage/ipc/standby.c +++ b/src/backend/storage/ipc/standby.c @@ -889,7 +889,7 @@ standby_redo(XLogReaderState *record) * up from a checkpoint and are immediately at our starting point, we * unconditionally move to STANDBY_INITIALIZED. After this point we * must do 4 things: - * * move shared nextFullXid forwards as we see new xids + * * move shared nextXid forwards as we see new xids * * extend the clog and subtrans with each new xid * * keep track of uncommitted known assigned xids * * keep track of uncommitted AccessExclusiveLocks diff --git a/src/backend/storage/lmgr/predicate.c b/src/backend/storage/lmgr/predicate.c index d24919f76b..a2f8e7524b 100644 --- a/src/backend/storage/lmgr/predicate.c +++ b/src/backend/storage/lmgr/predicate.c @@ -3390,7 +3390,7 @@ ReleasePredicateLocks(bool isCommit, bool isReadOnlySafe) * transaction to complete before freeing some RAM; correctness of visible * behavior is not affected. */ - MySerializableXact->finishedBefore = XidFromFullTransactionId(ShmemVariableCache->nextFullXid); + MySerializableXact->finishedBefore = XidFromFullTransactionId(ShmemVariableCache->nextXid); /* * If it's not a commit it's either a rollback or a read-only transaction diff --git a/src/backend/utils/misc/pg_controldata.c b/src/backend/utils/misc/pg_controldata.c index 419b58330f..6092312758 100644 --- a/src/backend/utils/misc/pg_controldata.c +++ b/src/backend/utils/misc/pg_controldata.c @@ -165,8 +165,8 @@ pg_control_checkpoint(PG_FUNCTION_ARGS) nulls[5] = false; values[6] = CStringGetTextDatum(psprintf("%u:%u", - EpochFromFullTransactionId(ControlFile->checkPointCopy.nextFullXid), - XidFromFullTransactionId(ControlFile->checkPointCopy.nextFullXid))); + EpochFromFullTransactionId(ControlFile->checkPointCopy.nextXid), + XidFromFullTransactionId(ControlFile->checkPointCopy.nextXid))); nulls[6] = false; values[7] = ObjectIdGetDatum(ControlFile->checkPointCopy.nextOid); diff --git a/src/bin/pg_controldata/pg_controldata.c b/src/bin/pg_controldata/pg_controldata.c index e73639df74..3e00ac0f70 100644 --- a/src/bin/pg_controldata/pg_controldata.c +++ b/src/bin/pg_controldata/pg_controldata.c @@ -250,8 +250,8 @@ main(int argc, char *argv[]) printf(_("Latest checkpoint's full_page_writes: %s\n"), ControlFile->checkPointCopy.fullPageWrites ? _("on") : _("off")); printf(_("Latest checkpoint's NextXID: %u:%u\n"), - EpochFromFullTransactionId(ControlFile->checkPointCopy.nextFullXid), - XidFromFullTransactionId(ControlFile->checkPointCopy.nextFullXid)); + EpochFromFullTransactionId(ControlFile->checkPointCopy.nextXid), + XidFromFullTransactionId(ControlFile->checkPointCopy.nextXid)); printf(_("Latest checkpoint's NextOID: %u\n"), ControlFile->checkPointCopy.nextOid); printf(_("Latest checkpoint's NextMultiXactId: %u\n"), diff --git a/src/bin/pg_resetwal/pg_resetwal.c b/src/bin/pg_resetwal/pg_resetwal.c index 233441837f..cb6ef19182 100644 --- a/src/bin/pg_resetwal/pg_resetwal.c +++ b/src/bin/pg_resetwal/pg_resetwal.c @@ -424,14 +424,14 @@ main(int argc, char *argv[]) * if any, includes these values.) */ if (set_xid_epoch != -1) - ControlFile.checkPointCopy.nextFullXid = + ControlFile.checkPointCopy.nextXid = FullTransactionIdFromEpochAndXid(set_xid_epoch, - XidFromFullTransactionId(ControlFile.checkPointCopy.nextFullXid)); + XidFromFullTransactionId(ControlFile.checkPointCopy.nextXid)); if (set_xid != 0) { - ControlFile.checkPointCopy.nextFullXid = - FullTransactionIdFromEpochAndXid(EpochFromFullTransactionId(ControlFile.checkPointCopy.nextFullXid), + ControlFile.checkPointCopy.nextXid = + FullTransactionIdFromEpochAndXid(EpochFromFullTransactionId(ControlFile.checkPointCopy.nextXid), set_xid); /* @@ -684,7 +684,7 @@ GuessControlValues(void) ControlFile.checkPointCopy.ThisTimeLineID = 1; ControlFile.checkPointCopy.PrevTimeLineID = 1; ControlFile.checkPointCopy.fullPageWrites = false; - ControlFile.checkPointCopy.nextFullXid = + ControlFile.checkPointCopy.nextXid = FullTransactionIdFromEpochAndXid(0, FirstNormalTransactionId); ControlFile.checkPointCopy.nextOid = FirstBootstrapObjectId; ControlFile.checkPointCopy.nextMulti = FirstMultiXactId; @@ -756,8 +756,8 @@ PrintControlValues(bool guessed) printf(_("Latest checkpoint's full_page_writes: %s\n"), ControlFile.checkPointCopy.fullPageWrites ? _("on") : _("off")); printf(_("Latest checkpoint's NextXID: %u:%u\n"), - EpochFromFullTransactionId(ControlFile.checkPointCopy.nextFullXid), - XidFromFullTransactionId(ControlFile.checkPointCopy.nextFullXid)); + EpochFromFullTransactionId(ControlFile.checkPointCopy.nextXid), + XidFromFullTransactionId(ControlFile.checkPointCopy.nextXid)); printf(_("Latest checkpoint's NextOID: %u\n"), ControlFile.checkPointCopy.nextOid); printf(_("Latest checkpoint's NextMultiXactId: %u\n"), @@ -847,7 +847,7 @@ PrintNewControlValues(void) if (set_xid != 0) { printf(_("NextXID: %u\n"), - XidFromFullTransactionId(ControlFile.checkPointCopy.nextFullXid)); + XidFromFullTransactionId(ControlFile.checkPointCopy.nextXid)); printf(_("OldestXID: %u\n"), ControlFile.checkPointCopy.oldestXid); printf(_("OldestXID's DB: %u\n"), @@ -857,7 +857,7 @@ PrintNewControlValues(void) if (set_xid_epoch != -1) { printf(_("NextXID epoch: %u\n"), - EpochFromFullTransactionId(ControlFile.checkPointCopy.nextFullXid)); + EpochFromFullTransactionId(ControlFile.checkPointCopy.nextXid)); } if (set_oldest_commit_ts_xid != 0) diff --git a/src/include/access/transam.h b/src/include/access/transam.h index a91a0c7487..85508300e9 100644 --- a/src/include/access/transam.h +++ b/src/include/access/transam.h @@ -175,12 +175,12 @@ typedef struct VariableCacheData /* * These fields are protected by XidGenLock. */ - FullTransactionId nextFullXid; /* next full XID to assign */ + FullTransactionId nextXid; /* next XID to assign */ TransactionId oldestXid; /* cluster-wide minimum datfrozenxid */ TransactionId xidVacLimit; /* start forcing autovacuums here */ TransactionId xidWarnLimit; /* start complaining here */ - TransactionId xidStopLimit; /* refuse to advance nextFullXid beyond here */ + TransactionId xidStopLimit; /* refuse to advance nextXid beyond here */ TransactionId xidWrapLimit; /* where the world ends */ Oid oldestXidDB; /* database with minimum datfrozenxid */ diff --git a/src/include/catalog/pg_control.h b/src/include/catalog/pg_control.h index de5670e538..06bed90c5e 100644 --- a/src/include/catalog/pg_control.h +++ b/src/include/catalog/pg_control.h @@ -40,7 +40,7 @@ typedef struct CheckPoint TimeLineID PrevTimeLineID; /* previous TLI, if this record begins a new * timeline (equals ThisTimeLineID otherwise) */ bool fullPageWrites; /* current full_page_writes */ - FullTransactionId nextFullXid; /* next free full transaction ID */ + FullTransactionId nextXid; /* next free transaction ID */ Oid nextOid; /* next free OID */ MultiXactId nextMulti; /* next free MultiXactId */ MultiXactOffset nextMultiOffset; /* next free MultiXact offset */ diff --git a/src/include/storage/standby.h b/src/include/storage/standby.h index cfbe426e5a..faaf1d3817 100644 --- a/src/include/storage/standby.h +++ b/src/include/storage/standby.h @@ -72,7 +72,7 @@ typedef struct RunningTransactionsData int xcnt; /* # of xact ids in xids[] */ int subxcnt; /* # of subxact ids in xids[] */ bool subxid_overflow; /* snapshot overflowed, subxids missing */ - TransactionId nextXid; /* xid from ShmemVariableCache->nextFullXid */ + TransactionId nextXid; /* xid from ShmemVariableCache->nextXid */ TransactionId oldestRunningXid; /* *not* oldestXmin */ TransactionId latestCompletedXid; /* so we can set xmax */ diff --git a/src/include/storage/standbydefs.h b/src/include/storage/standbydefs.h index 4876d2eeea..4dda1c403a 100644 --- a/src/include/storage/standbydefs.h +++ b/src/include/storage/standbydefs.h @@ -49,7 +49,7 @@ typedef struct xl_running_xacts int xcnt; /* # of xact ids in xids[] */ int subxcnt; /* # of subxact ids in xids[] */ bool subxid_overflow; /* snapshot overflowed, subxids missing */ - TransactionId nextXid; /* xid from ShmemVariableCache->nextFullXid */ + TransactionId nextXid; /* xid from ShmemVariableCache->nextXid */ TransactionId oldestRunningXid; /* *not* oldestXmin */ TransactionId latestCompletedXid; /* so we can set xmax */