diff options
Diffstat (limited to 'src/backend/utils')
-rw-r--r-- | src/backend/utils/adt/txid.c | 13 | ||||
-rw-r--r-- | src/backend/utils/misc/pg_controldata.c | 5 |
2 files changed, 12 insertions, 6 deletions
diff --git a/src/backend/utils/adt/txid.c b/src/backend/utils/adt/txid.c index 9958b1a55e8..4483db573f3 100644 --- a/src/backend/utils/adt/txid.c +++ b/src/backend/utils/adt/txid.c @@ -91,7 +91,10 @@ typedef struct static void load_xid_epoch(TxidEpoch *state) { - GetNextXidAndEpoch(&state->last_xid, &state->epoch); + FullTransactionId fullXid = ReadNextFullTransactionId(); + + state->last_xid = XidFromFullTransactionId(fullXid); + state->epoch = EpochFromFullTransactionId(fullXid); } /* @@ -114,8 +117,11 @@ TransactionIdInRecentPast(uint64 xid_with_epoch, TransactionId *extracted_xid) TransactionId xid = (TransactionId) xid_with_epoch; uint32 now_epoch; TransactionId now_epoch_next_xid; + FullTransactionId now_fullxid; - GetNextXidAndEpoch(&now_epoch_next_xid, &now_epoch); + now_fullxid = ReadNextFullTransactionId(); + now_epoch_next_xid = XidFromFullTransactionId(now_fullxid); + now_epoch = EpochFromFullTransactionId(now_fullxid); if (extracted_xid != NULL) *extracted_xid = xid; @@ -128,8 +134,7 @@ TransactionIdInRecentPast(uint64 xid_with_epoch, TransactionId *extracted_xid) return true; /* If the transaction ID is in the future, throw an error. */ - if (xid_epoch > now_epoch - || (xid_epoch == now_epoch && xid >= now_epoch_next_xid)) + if (xid_with_epoch >= U64FromFullTransactionId(now_fullxid)) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("transaction ID %s is in the future", diff --git a/src/backend/utils/misc/pg_controldata.c b/src/backend/utils/misc/pg_controldata.c index e6742dc24b8..e675c33c547 100644 --- a/src/backend/utils/misc/pg_controldata.c +++ b/src/backend/utils/misc/pg_controldata.c @@ -16,6 +16,7 @@ #include "postgres.h" #include "access/htup_details.h" +#include "access/transam.h" #include "access/xlog_internal.h" #include "access/xlog.h" #include "catalog/pg_control.h" @@ -164,8 +165,8 @@ pg_control_checkpoint(PG_FUNCTION_ARGS) nulls[5] = false; values[6] = CStringGetTextDatum(psprintf("%u:%u", - ControlFile->checkPointCopy.nextXidEpoch, - ControlFile->checkPointCopy.nextXid)); + EpochFromFullTransactionId(ControlFile->checkPointCopy.nextFullXid), + XidFromFullTransactionId(ControlFile->checkPointCopy.nextFullXid))); nulls[6] = false; values[7] = ObjectIdGetDatum(ControlFile->checkPointCopy.nextOid); |