aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/txid.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/utils/adt/txid.c')
-rw-r--r--src/backend/utils/adt/txid.c13
1 files changed, 9 insertions, 4 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",