Skip to content
Snippets Groups Projects
Commit 867540b4 authored by Simon Riggs's avatar Simon Riggs
Browse files

Ensure backwards compatibility for GetStableLatestTransactionId()

parent afe86a9e
No related branches found
No related tags found
No related merge requests found
......@@ -390,11 +390,10 @@ GetCurrentTransactionIdIfAny(void)
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.
*/
TransactionId
......@@ -403,13 +402,16 @@ GetStableLatestTransactionId(void)
static LocalTransactionId lxid = InvalidLocalTransactionId;
static TransactionId stablexid = InvalidTransactionId;
if (lxid != MyProc->lxid ||
!TransactionIdIsValid(stablexid))
if (lxid != MyProc->lxid)
{
lxid = MyProc->lxid;
stablexid = GetTopTransactionIdIfAny();
if (!TransactionIdIsValid(stablexid))
stablexid = ReadNewTransactionId();
}
Assert(TransactionIdIsValid(stablexid));
return stablexid;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment