diff options
author | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2023-12-08 09:47:15 +0200 |
---|---|---|
committer | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2023-12-08 09:47:15 +0200 |
commit | b31ba5310b5176402b60abc0454a033b1210ab75 (patch) | |
tree | 664161b9838a21c86e2402dc48f73d1336936270 /src/backend/access/transam/xlog.c | |
parent | 15916ffb0468d0b1036ba661767fe6e1b5fb3ee8 (diff) | |
download | postgresql-b31ba5310b5176402b60abc0454a033b1210ab75.tar.gz postgresql-b31ba5310b5176402b60abc0454a033b1210ab75.zip |
Rename ShmemVariableCache to TransamVariables
The old name was misleading: It's not a cache, the values kept in the
struct are the authoritative source.
Reviewed-by: Tristan Partin, Richard Guo
Discussion: https://www.postgresql.org/message-id/6537d63d-4bb5-46f8-9b5d-73a8ba4720ab@iki.fi
Diffstat (limited to 'src/backend/access/transam/xlog.c')
-rw-r--r-- | src/backend/access/transam/xlog.c | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 2d603d8dee2..daed1a7a493 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -4819,9 +4819,9 @@ BootStrapXLOG(void) checkPoint.time = (pg_time_t) time(NULL); checkPoint.oldestActiveXid = InvalidTransactionId; - ShmemVariableCache->nextXid = checkPoint.nextXid; - ShmemVariableCache->nextOid = checkPoint.nextOid; - ShmemVariableCache->oidCount = 0; + TransamVariables->nextXid = checkPoint.nextXid; + TransamVariables->nextOid = checkPoint.nextOid; + TransamVariables->oidCount = 0; MultiXactSetNextMXact(checkPoint.nextMulti, checkPoint.nextMultiOffset); AdvanceOldestClogXid(checkPoint.oldestXid); SetTransactionIdLimit(checkPoint.oldestXid, checkPoint.oldestXidDB); @@ -5285,9 +5285,9 @@ StartupXLOG(void) checkPoint = ControlFile->checkPointCopy; /* initialize shared memory variables from the checkpoint record */ - ShmemVariableCache->nextXid = checkPoint.nextXid; - ShmemVariableCache->nextOid = checkPoint.nextOid; - ShmemVariableCache->oidCount = 0; + TransamVariables->nextXid = checkPoint.nextXid; + TransamVariables->nextOid = checkPoint.nextOid; + TransamVariables->oidCount = 0; MultiXactSetNextMXact(checkPoint.nextMulti, checkPoint.nextMultiOffset); AdvanceOldestClogXid(checkPoint.oldestXid); SetTransactionIdLimit(checkPoint.oldestXid, checkPoint.oldestXidDB); @@ -5323,7 +5323,7 @@ StartupXLOG(void) StartupReorderBuffer(); /* - * Startup CLOG. This must be done after ShmemVariableCache->nextXid has + * Startup CLOG. This must be done after TransamVariables->nextXid has * been initialized and before we accept connections or begin WAL replay. */ StartupCLOG(); @@ -5512,7 +5512,7 @@ StartupXLOG(void) Assert(TransactionIdIsValid(oldestActiveXID)); /* Tell procarray about the range of xids it has to deal with */ - ProcArrayInitRecovery(XidFromFullTransactionId(ShmemVariableCache->nextXid)); + ProcArrayInitRecovery(XidFromFullTransactionId(TransamVariables->nextXid)); /* * Startup subtrans only. CLOG, MultiXact and commit timestamp @@ -5786,8 +5786,8 @@ StartupXLOG(void) /* also initialize latestCompletedXid, to nextXid - 1 */ LWLockAcquire(ProcArrayLock, LW_EXCLUSIVE); - ShmemVariableCache->latestCompletedXid = ShmemVariableCache->nextXid; - FullTransactionIdRetreat(&ShmemVariableCache->latestCompletedXid); + TransamVariables->latestCompletedXid = TransamVariables->nextXid; + FullTransactionIdRetreat(&TransamVariables->latestCompletedXid); LWLockRelease(ProcArrayLock); /* @@ -6779,20 +6779,20 @@ CreateCheckPoint(int flags) * there. */ LWLockAcquire(XidGenLock, LW_SHARED); - checkPoint.nextXid = ShmemVariableCache->nextXid; - checkPoint.oldestXid = ShmemVariableCache->oldestXid; - checkPoint.oldestXidDB = ShmemVariableCache->oldestXidDB; + checkPoint.nextXid = TransamVariables->nextXid; + checkPoint.oldestXid = TransamVariables->oldestXid; + checkPoint.oldestXidDB = TransamVariables->oldestXidDB; LWLockRelease(XidGenLock); LWLockAcquire(CommitTsLock, LW_SHARED); - checkPoint.oldestCommitTsXid = ShmemVariableCache->oldestCommitTsXid; - checkPoint.newestCommitTsXid = ShmemVariableCache->newestCommitTsXid; + checkPoint.oldestCommitTsXid = TransamVariables->oldestCommitTsXid; + checkPoint.newestCommitTsXid = TransamVariables->newestCommitTsXid; LWLockRelease(CommitTsLock); LWLockAcquire(OidGenLock, LW_SHARED); - checkPoint.nextOid = ShmemVariableCache->nextOid; + checkPoint.nextOid = TransamVariables->nextOid; if (!shutdown) - checkPoint.nextOid += ShmemVariableCache->oidCount; + checkPoint.nextOid += TransamVariables->oidCount; LWLockRelease(OidGenLock); MultiXactGetCheckptMulti(shutdown, @@ -7884,16 +7884,16 @@ xlog_redo(XLogReaderState *record) Oid nextOid; /* - * We used to try to take the maximum of ShmemVariableCache->nextOid - * and the recorded nextOid, but that fails if the OID counter wraps + * We used to try to take the maximum of TransamVariables->nextOid and + * the recorded nextOid, but that fails if the OID counter wraps * around. Since no OID allocation should be happening during replay * anyway, better to just believe the record exactly. We still take * OidGenLock while setting the variable, just in case. */ memcpy(&nextOid, XLogRecGetData(record), sizeof(Oid)); LWLockAcquire(OidGenLock, LW_EXCLUSIVE); - ShmemVariableCache->nextOid = nextOid; - ShmemVariableCache->oidCount = 0; + TransamVariables->nextOid = nextOid; + TransamVariables->oidCount = 0; LWLockRelease(OidGenLock); } else if (info == XLOG_CHECKPOINT_SHUTDOWN) @@ -7904,11 +7904,11 @@ xlog_redo(XLogReaderState *record) memcpy(&checkPoint, XLogRecGetData(record), sizeof(CheckPoint)); /* In a SHUTDOWN checkpoint, believe the counters exactly */ LWLockAcquire(XidGenLock, LW_EXCLUSIVE); - ShmemVariableCache->nextXid = checkPoint.nextXid; + TransamVariables->nextXid = checkPoint.nextXid; LWLockRelease(XidGenLock); LWLockAcquire(OidGenLock, LW_EXCLUSIVE); - ShmemVariableCache->nextOid = checkPoint.nextOid; - ShmemVariableCache->oidCount = 0; + TransamVariables->nextOid = checkPoint.nextOid; + TransamVariables->oidCount = 0; LWLockRelease(OidGenLock); MultiXactSetNextMXact(checkPoint.nextMulti, checkPoint.nextMultiOffset); @@ -8001,9 +8001,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->nextXid, + if (FullTransactionIdPrecedes(TransamVariables->nextXid, checkPoint.nextXid)) - ShmemVariableCache->nextXid = checkPoint.nextXid; + TransamVariables->nextXid = checkPoint.nextXid; LWLockRelease(XidGenLock); /* @@ -8028,7 +8028,7 @@ xlog_redo(XLogReaderState *record) */ MultiXactAdvanceOldest(checkPoint.oldestMulti, checkPoint.oldestMultiDB); - if (TransactionIdPrecedes(ShmemVariableCache->oldestXid, + if (TransactionIdPrecedes(TransamVariables->oldestXid, checkPoint.oldestXid)) SetTransactionIdLimit(checkPoint.oldestXid, checkPoint.oldestXidDB); |