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 @@ -392,11 +392,10 @@ GetCurrentTransactionIdIfAny(void)
392
392
return CurrentTransactionState -> transactionId ;
393
393
}
394
394
395
-
396
395
/*
397
- * GetStableLatestTransactionIdIfAny
396
+ * GetStableLatestTransactionId
398
397
*
399
- * Get the latest XID once and then return same value for rest of transaction.
398
+ * Get the XID once and then return same value for rest of transaction.
400
399
* Acts as a useful reference point for maintenance tasks.
401
400
*/
402
401
TransactionId
@@ -405,13 +404,16 @@ GetStableLatestTransactionId(void)
405
404
static LocalTransactionId lxid = InvalidLocalTransactionId ;
406
405
static TransactionId stablexid = InvalidTransactionId ;
407
406
408
- if (lxid != MyProc -> lxid ||
409
- !TransactionIdIsValid (stablexid ))
407
+ if (lxid != MyProc -> lxid )
410
408
{
411
409
lxid = MyProc -> lxid ;
412
- stablexid = ReadNewTransactionId ();
410
+ stablexid = GetTopTransactionIdIfAny ();
411
+ if (!TransactionIdIsValid (stablexid ))
412
+ stablexid = ReadNewTransactionId ();
413
413
}
414
414
415
+ Assert (TransactionIdIsValid (stablexid ));
416
+
415
417
return stablexid ;
416
418
}
417
419
You can’t perform that action at this time.
0 commit comments