checkpoint->oldestXidDB,
checkpoint->oldestMulti,
checkpoint->oldestMultiDB,
- checkpoint->oldestCommitTs,
- checkpoint->newestCommitTs,
+ checkpoint->oldestCommitTsXid,
+ checkpoint->newestCommitTsXid,
checkpoint->oldestActiveXid,
(info == XLOG_CHECKPOINT_SHUTDOWN) ? "shutdown" : "online");
}
commitTsShared->dataLastCommit.nodeid = nodeid;
/* and move forwards our endpoint, if needed */
- if (TransactionIdPrecedes(ShmemVariableCache->newestCommitTs, newestXact))
- ShmemVariableCache->newestCommitTs = newestXact;
+ if (TransactionIdPrecedes(ShmemVariableCache->newestCommitTsXid, newestXact))
+ ShmemVariableCache->newestCommitTsXid = newestXact;
LWLockRelease(CommitTsLock);
}
int entryno = TransactionIdToCTsEntry(xid);
int slotno;
CommitTimestampEntry entry;
- TransactionId oldestCommitTs;
- TransactionId newestCommitTs;
+ TransactionId oldestCommitTsXid;
+ TransactionId newestCommitTsXid;
/* error if the given Xid doesn't normally commit */
if (!TransactionIdIsNormal(xid))
return *ts != 0;
}
- oldestCommitTs = ShmemVariableCache->oldestCommitTs;
- newestCommitTs = ShmemVariableCache->newestCommitTs;
+ oldestCommitTsXid = ShmemVariableCache->oldestCommitTsXid;
+ newestCommitTsXid = ShmemVariableCache->newestCommitTsXid;
/* neither is invalid, or both are */
- Assert(TransactionIdIsValid(oldestCommitTs) == TransactionIdIsValid(newestCommitTs));
+ Assert(TransactionIdIsValid(oldestCommitTsXid) == TransactionIdIsValid(newestCommitTsXid));
LWLockRelease(CommitTsLock);
/*
* Return empty if the requested value is outside our valid range.
*/
- if (!TransactionIdIsValid(oldestCommitTs) ||
- TransactionIdPrecedes(xid, oldestCommitTs) ||
- TransactionIdPrecedes(newestCommitTs, xid))
+ if (!TransactionIdIsValid(oldestCommitTsXid) ||
+ TransactionIdPrecedes(xid, oldestCommitTsXid) ||
+ TransactionIdPrecedes(newestCommitTsXid, xid))
{
*ts = 0;
if (nodeid)
* enabled again? It doesn't look like it does, because there should be a
* checkpoint that sets the value to InvalidTransactionId at end of
* recovery; and so any chance of injecting new transactions without
- * CommitTs values would occur after the oldestCommitTs has been set to
+ * CommitTs values would occur after the oldestCommitTsXid has been set to
* Invalid temporarily.
*/
LWLockAcquire(CommitTsLock, LW_EXCLUSIVE);
- if (ShmemVariableCache->oldestCommitTs == InvalidTransactionId)
+ if (ShmemVariableCache->oldestCommitTsXid == InvalidTransactionId)
{
- ShmemVariableCache->oldestCommitTs =
- ShmemVariableCache->newestCommitTs = ReadNewTransactionId();
+ ShmemVariableCache->oldestCommitTsXid =
+ ShmemVariableCache->newestCommitTsXid = ReadNewTransactionId();
}
LWLockRelease(CommitTsLock);
TIMESTAMP_NOBEGIN(commitTsShared->dataLastCommit.time);
commitTsShared->dataLastCommit.nodeid = InvalidRepOriginId;
- ShmemVariableCache->oldestCommitTs = InvalidTransactionId;
- ShmemVariableCache->newestCommitTs = InvalidTransactionId;
+ ShmemVariableCache->oldestCommitTsXid = InvalidTransactionId;
+ ShmemVariableCache->newestCommitTsXid = InvalidTransactionId;
LWLockRelease(CommitTsLock);
* "future" or signal a disabled committs.
*/
LWLockAcquire(CommitTsLock, LW_EXCLUSIVE);
- if (ShmemVariableCache->oldestCommitTs != InvalidTransactionId)
+ if (ShmemVariableCache->oldestCommitTsXid != InvalidTransactionId)
{
- if (TransactionIdPrecedes(ShmemVariableCache->oldestCommitTs, oldestXact))
- ShmemVariableCache->oldestCommitTs = oldestXact;
- if (TransactionIdPrecedes(newestXact, ShmemVariableCache->newestCommitTs))
- ShmemVariableCache->newestCommitTs = newestXact;
+ if (TransactionIdPrecedes(ShmemVariableCache->oldestCommitTsXid, oldestXact))
+ ShmemVariableCache->oldestCommitTsXid = oldestXact;
+ if (TransactionIdPrecedes(newestXact, ShmemVariableCache->newestCommitTsXid))
+ ShmemVariableCache->newestCommitTsXid = newestXact;
}
else
{
- Assert(ShmemVariableCache->newestCommitTs == InvalidTransactionId);
+ Assert(ShmemVariableCache->newestCommitTsXid == InvalidTransactionId);
}
LWLockRelease(CommitTsLock);
}
* Move forwards the oldest commitTS value that can be consulted
*/
void
-AdvanceOldestCommitTs(TransactionId oldestXact)
+AdvanceOldestCommitTsXid(TransactionId oldestXact)
{
LWLockAcquire(CommitTsLock, LW_EXCLUSIVE);
- if (ShmemVariableCache->oldestCommitTs != InvalidTransactionId &&
- TransactionIdPrecedes(ShmemVariableCache->oldestCommitTs, oldestXact))
- ShmemVariableCache->oldestCommitTs = oldestXact;
+ if (ShmemVariableCache->oldestCommitTsXid != InvalidTransactionId &&
+ TransactionIdPrecedes(ShmemVariableCache->oldestCommitTsXid, oldestXact))
+ ShmemVariableCache->oldestCommitTsXid = oldestXact;
LWLockRelease(CommitTsLock);
}
checkPoint.oldestXidDB = TemplateDbOid;
checkPoint.oldestMulti = FirstMultiXactId;
checkPoint.oldestMultiDB = TemplateDbOid;
- checkPoint.oldestCommitTs = InvalidTransactionId;
- checkPoint.newestCommitTs = InvalidTransactionId;
+ checkPoint.oldestCommitTsXid = InvalidTransactionId;
+ checkPoint.newestCommitTsXid = InvalidTransactionId;
checkPoint.time = (pg_time_t) time(NULL);
checkPoint.oldestActiveXid = InvalidTransactionId;
checkPoint.oldestMulti, checkPoint.oldestMultiDB)));
ereport(DEBUG1,
(errmsg_internal("commit timestamp Xid oldest/newest: %u/%u",
- checkPoint.oldestCommitTs,
- checkPoint.newestCommitTs)));
+ checkPoint.oldestCommitTsXid,
+ checkPoint.newestCommitTsXid)));
if (!TransactionIdIsNormal(checkPoint.nextXid))
ereport(PANIC,
(errmsg("invalid next transaction ID")));
MultiXactSetNextMXact(checkPoint.nextMulti, checkPoint.nextMultiOffset);
SetTransactionIdLimit(checkPoint.oldestXid, checkPoint.oldestXidDB);
SetMultiXactIdLimit(checkPoint.oldestMulti, checkPoint.oldestMultiDB);
- SetCommitTsLimit(checkPoint.oldestCommitTs,
- checkPoint.newestCommitTs);
+ SetCommitTsLimit(checkPoint.oldestCommitTsXid,
+ checkPoint.newestCommitTsXid);
XLogCtl->ckptXidEpoch = checkPoint.nextXidEpoch;
XLogCtl->ckptXid = checkPoint.nextXid;
LWLockRelease(XidGenLock);
LWLockAcquire(CommitTsLock, LW_SHARED);
- checkPoint.oldestCommitTs = ShmemVariableCache->oldestCommitTs;
- checkPoint.newestCommitTs = ShmemVariableCache->newestCommitTs;
+ checkPoint.oldestCommitTsXid = ShmemVariableCache->oldestCommitTsXid;
+ checkPoint.newestCommitTsXid = ShmemVariableCache->newestCommitTsXid;
LWLockRelease(CommitTsLock);
/* Increase XID epoch if we've wrapped around since last checkpoint */
*/
SetTransactionIdLimit(frozenXID, oldestxid_datoid);
SetMultiXactIdLimit(minMulti, minmulti_datoid);
- AdvanceOldestCommitTs(frozenXID);
+ AdvanceOldestCommitTsXid(frozenXID);
}
ControlFile.checkPointCopy.oldestMulti);
printf(_("Latest checkpoint's oldestMulti's DB: %u\n"),
ControlFile.checkPointCopy.oldestMultiDB);
- printf(_("Latest checkpoint's oldestCommitTs: %u\n"),
- ControlFile.checkPointCopy.oldestCommitTs);
- printf(_("Latest checkpoint's newestCommitTs: %u\n"),
- ControlFile.checkPointCopy.newestCommitTs);
+ printf(_("Latest checkpoint's oldestCommitTsXid:%u\n"),
+ ControlFile.checkPointCopy.oldestCommitTsXid);
+ printf(_("Latest checkpoint's newestCommitTsXid:%u\n"),
+ ControlFile.checkPointCopy.newestCommitTsXid);
printf(_("Time of latest checkpoint: %s\n"),
ckpttime_str);
printf(_("Fake LSN counter for unlogged rels: %X/%X\n"),
static const char *progname;
static uint32 set_xid_epoch = (uint32) -1;
static TransactionId set_xid = 0;
-static TransactionId set_oldest_commit_ts = 0;
-static TransactionId set_newest_commit_ts = 0;
+static TransactionId set_oldest_commit_ts_xid = 0;
+static TransactionId set_newest_commit_ts_xid = 0;
static Oid set_oid = 0;
static MultiXactId set_mxid = 0;
static MultiXactOffset set_mxoff = (MultiXactOffset) -1;
break;
case 'c':
- set_oldest_commit_ts = strtoul(optarg, &endptr, 0);
+ set_oldest_commit_ts_xid = strtoul(optarg, &endptr, 0);
if (endptr == optarg || *endptr != ',')
{
fprintf(stderr, _("%s: invalid argument for option %s\n"), progname, "-c");
fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname);
exit(1);
}
- set_newest_commit_ts = strtoul(endptr + 1, &endptr2, 0);
+ set_newest_commit_ts_xid = strtoul(endptr + 1, &endptr2, 0);
if (endptr2 == endptr + 1 || *endptr2 != '\0')
{
fprintf(stderr, _("%s: invalid argument for option %s\n"), progname, "-c");
exit(1);
}
- if (set_oldest_commit_ts < 2 &&
- set_oldest_commit_ts != 0)
+ if (set_oldest_commit_ts_xid < 2 &&
+ set_oldest_commit_ts_xid != 0)
{
fprintf(stderr, _("%s: transaction ID (-c) must be either 0 or greater than or equal to 2\n"), progname);
exit(1);
}
- if (set_newest_commit_ts < 2 &&
- set_newest_commit_ts != 0)
+ if (set_newest_commit_ts_xid < 2 &&
+ set_newest_commit_ts_xid != 0)
{
fprintf(stderr, _("%s: transaction ID (-c) must be either 0 or greater than or equal to 2\n"), progname);
exit(1);
ControlFile.checkPointCopy.oldestXidDB = InvalidOid;
}
- if (set_oldest_commit_ts != 0)
- ControlFile.checkPointCopy.oldestCommitTs = set_oldest_commit_ts;
- if (set_newest_commit_ts != 0)
- ControlFile.checkPointCopy.newestCommitTs = set_newest_commit_ts;
+ if (set_oldest_commit_ts_xid != 0)
+ ControlFile.checkPointCopy.oldestCommitTsXid = set_oldest_commit_ts_xid;
+ if (set_newest_commit_ts_xid != 0)
+ ControlFile.checkPointCopy.newestCommitTsXid = set_newest_commit_ts_xid;
if (set_oid != 0)
ControlFile.checkPointCopy.nextOid = set_oid;
ControlFile.checkPointCopy.oldestMulti);
printf(_("Latest checkpoint's oldestMulti's DB: %u\n"),
ControlFile.checkPointCopy.oldestMultiDB);
- printf(_("Latest checkpoint's oldestCommitTs: %u\n"),
- ControlFile.checkPointCopy.oldestCommitTs);
- printf(_("Latest checkpoint's newestCommitTs: %u\n"),
- ControlFile.checkPointCopy.newestCommitTs);
+ printf(_("Latest checkpoint's oldestCommitTsXid:%u\n"),
+ ControlFile.checkPointCopy.oldestCommitTsXid);
+ printf(_("Latest checkpoint's newestCommitTsXid:%u\n"),
+ ControlFile.checkPointCopy.newestCommitTsXid);
printf(_("Maximum data alignment: %u\n"),
ControlFile.maxAlign);
/* we don't print floatFormat since can't say much useful about it */
ControlFile.checkPointCopy.nextXidEpoch);
}
- if (set_oldest_commit_ts != 0)
+ if (set_oldest_commit_ts_xid != 0)
{
- printf(_("oldestCommitTs: %u\n"),
- ControlFile.checkPointCopy.oldestCommitTs);
+ printf(_("oldestCommitTsXid: %u\n"),
+ ControlFile.checkPointCopy.oldestCommitTsXid);
}
- if (set_newest_commit_ts != 0)
+ if (set_newest_commit_ts_xid != 0)
{
- printf(_("newestCommitTs: %u\n"),
- ControlFile.checkPointCopy.newestCommitTs);
+ printf(_("newestCommitTsXid: %u\n"),
+ ControlFile.checkPointCopy.newestCommitTsXid);
}
}
extern void TruncateCommitTs(TransactionId oldestXact);
extern void SetCommitTsLimit(TransactionId oldestXact,
TransactionId newestXact);
-extern void AdvanceOldestCommitTs(TransactionId oldestXact);
+extern void AdvanceOldestCommitTsXid(TransactionId oldestXact);
/* XLOG stuff */
#define COMMIT_TS_ZEROPAGE 0x00
/*
* These fields are protected by CommitTsLock
*/
- TransactionId oldestCommitTs;
- TransactionId newestCommitTs;
+ TransactionId oldestCommitTsXid;
+ TransactionId newestCommitTsXid;
/*
* These fields are protected by ProcArrayLock.
MultiXactId oldestMulti; /* cluster-wide minimum datminmxid */
Oid oldestMultiDB; /* database with minimum datminmxid */
pg_time_t time; /* time stamp of checkpoint */
- TransactionId oldestCommitTs; /* oldest Xid with valid commit
+ TransactionId oldestCommitTsXid; /* oldest Xid with valid commit
* timestamp */
- TransactionId newestCommitTs; /* newest Xid with valid commit
+ TransactionId newestCommitTsXid; /* newest Xid with valid commit
* timestamp */
/*