Ensure backwards compatibility for GetStableLatestTransactionId()
This commit is contained in:
parent
afe86a9e73
commit
867540b49c
@ -390,11 +390,10 @@ GetCurrentTransactionIdIfAny(void)
|
|||||||
return CurrentTransactionState->transactionId;
|
return CurrentTransactionState->transactionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* GetStableLatestTransactionIdIfAny
|
* GetStableLatestTransactionId
|
||||||
*
|
*
|
||||||
* Get the latest XID once and then return same value for rest of transaction.
|
* Get the XID once and then return same value for rest of transaction.
|
||||||
* Acts as a useful reference point for maintenance tasks.
|
* Acts as a useful reference point for maintenance tasks.
|
||||||
*/
|
*/
|
||||||
TransactionId
|
TransactionId
|
||||||
@ -403,13 +402,16 @@ GetStableLatestTransactionId(void)
|
|||||||
static LocalTransactionId lxid = InvalidLocalTransactionId;
|
static LocalTransactionId lxid = InvalidLocalTransactionId;
|
||||||
static TransactionId stablexid = InvalidTransactionId;
|
static TransactionId stablexid = InvalidTransactionId;
|
||||||
|
|
||||||
if (lxid != MyProc->lxid ||
|
if (lxid != MyProc->lxid)
|
||||||
!TransactionIdIsValid(stablexid))
|
|
||||||
{
|
{
|
||||||
lxid = MyProc->lxid;
|
lxid = MyProc->lxid;
|
||||||
stablexid = ReadNewTransactionId();
|
stablexid = GetTopTransactionIdIfAny();
|
||||||
|
if (!TransactionIdIsValid(stablexid))
|
||||||
|
stablexid = ReadNewTransactionId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Assert(TransactionIdIsValid(stablexid));
|
||||||
|
|
||||||
return stablexid;
|
return stablexid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user