File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
src/backend/access/transam Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -386,11 +386,10 @@ GetCurrentTransactionIdIfAny(void)
386
386
return CurrentTransactionState -> transactionId ;
387
387
}
388
388
389
-
390
389
/*
391
- * GetStableLatestTransactionIdIfAny
390
+ * GetStableLatestTransactionId
392
391
*
393
- * Get the latest XID once and then return same value for rest of transaction.
392
+ * Get the XID once and then return same value for rest of transaction.
394
393
* Acts as a useful reference point for maintenance tasks.
395
394
*/
396
395
TransactionId
@@ -399,13 +398,16 @@ GetStableLatestTransactionId(void)
399
398
static LocalTransactionId lxid = InvalidLocalTransactionId ;
400
399
static TransactionId stablexid = InvalidTransactionId ;
401
400
402
- if (lxid != MyProc -> lxid ||
403
- !TransactionIdIsValid (stablexid ))
401
+ if (lxid != MyProc -> lxid )
404
402
{
405
403
lxid = MyProc -> lxid ;
406
- stablexid = ReadNewTransactionId ();
404
+ stablexid = GetTopTransactionIdIfAny ();
405
+ if (!TransactionIdIsValid (stablexid ))
406
+ stablexid = ReadNewTransactionId ();
407
407
}
408
408
409
+ Assert (TransactionIdIsValid (stablexid ));
410
+
409
411
return stablexid ;
410
412
}
411
413
You can’t perform that action at this time.
0 commit comments