Applies on top of v2 and nocfbot-0001. Not for the CF bot. Ask the clog only: TransactionIdDidAbort() on xmax. diff --git a/src/backend/access/heap/heapam_visibility.c b/src/backend/access/heap/heapam_visibility.c --- a/src/backend/access/heap/heapam_visibility.c +++ b/src/backend/access/heap/heapam_visibility.c @@ -1197,10 +1197,15 @@ HeapTupleSatisfiesVacuumHorizon(HeapTuple htup, Buffer buffer, TransactionId *de { TransactionId xmax = HeapTupleHeaderGetUpdateXid(tuple); - /* xmax == xmin: xmax is in progress too, nothing to do */ + /* + * xmin is in progress, so xmax is in the inserter's + * transaction tree. If xmax == xmin, it is in progress + * too. Otherwise it is running or it is a subtransaction + * that aborted, and the abort reaches the clog before the + * subtransaction leaves the proc array: the clog tells. + */ if (!TransactionIdEquals(xmax, HeapTupleHeaderGetRawXmin(tuple)) && - !TransactionIdIsInProgress(xmax) && - !TransactionIdDidCommit(xmax)) + TransactionIdDidAbort(xmax)) SetHintBits(tuple, buffer, HEAP_XMAX_INVALID, InvalidTransactionId); }