@@ -222,8 +222,9 @@ HeapTupleSatisfiesSelf(HeapTupleHeader tuple, Snapshot snapshot, Buffer buffer)
222222 TransactionId xmax ;
223223
224224 xmax = HeapTupleGetUpdateXid (tuple );
225- if (!TransactionIdIsValid (xmax ))
226- return true;
225+
226+ /* not LOCKED_ONLY, so it has to have an xmax */
227+ Assert (TransactionIdIsValid (xmax ));
227228
228229 /* updating subtransaction must have aborted */
229230 if (!TransactionIdIsCurrentTransactionId (xmax ))
@@ -276,14 +277,17 @@ HeapTupleSatisfiesSelf(HeapTupleHeader tuple, Snapshot snapshot, Buffer buffer)
276277 return true;
277278
278279 xmax = HeapTupleGetUpdateXid (tuple );
279- if (!TransactionIdIsValid (xmax ))
280- return true;
280+
281+ /* not LOCKED_ONLY, so it has to have an xmax */
282+ Assert (TransactionIdIsValid (xmax ));
283+
281284 if (TransactionIdIsCurrentTransactionId (xmax ))
282285 return false;
283286 if (TransactionIdIsInProgress (xmax ))
284287 return true;
285288 if (TransactionIdDidCommit (xmax ))
286289 return false;
290+ /* it must have aborted or crashed */
287291 return true;
288292 }
289293
@@ -690,8 +694,9 @@ HeapTupleSatisfiesUpdate(HeapTupleHeader tuple, CommandId curcid,
690694 TransactionId xmax ;
691695
692696 xmax = HeapTupleGetUpdateXid (tuple );
693- if (!TransactionIdIsValid (xmax ))
694- return HeapTupleMayBeUpdated ;
697+
698+ /* not LOCKED_ONLY, so it has to have an xmax */
699+ Assert (TransactionIdIsValid (xmax ));
695700
696701 /* updating subtransaction must have aborted */
697702 if (!TransactionIdIsCurrentTransactionId (xmax ))
@@ -766,14 +771,9 @@ HeapTupleSatisfiesUpdate(HeapTupleHeader tuple, CommandId curcid,
766771 }
767772
768773 xmax = HeapTupleGetUpdateXid (tuple );
769- if (!TransactionIdIsValid (xmax ))
770- {
771- if (MultiXactIdIsRunning (HeapTupleHeaderGetRawXmax (tuple )))
772- return HeapTupleBeingUpdated ;
773774
774- SetHintBits (tuple , buffer , HEAP_XMAX_INVALID , InvalidTransactionId );
775- return HeapTupleMayBeUpdated ;
776- }
775+ /* not LOCKED_ONLY, so it has to have an xmax */
776+ Assert (TransactionIdIsValid (xmax ));
777777
778778 if (TransactionIdIsCurrentTransactionId (xmax ))
779779 {
@@ -783,13 +783,18 @@ HeapTupleSatisfiesUpdate(HeapTupleHeader tuple, CommandId curcid,
783783 return HeapTupleInvisible ; /* updated before scan started */
784784 }
785785
786- if (MultiXactIdIsRunning ( HeapTupleHeaderGetRawXmax ( tuple ) ))
786+ if (TransactionIdIsInProgress ( xmax ))
787787 return HeapTupleBeingUpdated ;
788788
789789 if (TransactionIdDidCommit (xmax ))
790790 return HeapTupleUpdated ;
791+
792+ /* no member, even just a locker, alive anymore */
793+ if (!MultiXactIdIsRunning (HeapTupleHeaderGetRawXmax (tuple )))
794+ SetHintBits (tuple , buffer , HEAP_XMAX_INVALID ,
795+ InvalidTransactionId );
796+
791797 /* it must have aborted or crashed */
792- SetHintBits (tuple , buffer , HEAP_XMAX_INVALID , InvalidTransactionId );
793798 return HeapTupleMayBeUpdated ;
794799 }
795800
@@ -911,8 +916,9 @@ HeapTupleSatisfiesDirty(HeapTupleHeader tuple, Snapshot snapshot,
911916 TransactionId xmax ;
912917
913918 xmax = HeapTupleGetUpdateXid (tuple );
914- if (!TransactionIdIsValid (xmax ))
915- return true;
919+
920+ /* not LOCKED_ONLY, so it has to have an xmax */
921+ Assert (TransactionIdIsValid (xmax ));
916922
917923 /* updating subtransaction must have aborted */
918924 if (!TransactionIdIsCurrentTransactionId (xmax ))
@@ -969,8 +975,10 @@ HeapTupleSatisfiesDirty(HeapTupleHeader tuple, Snapshot snapshot,
969975 return true;
970976
971977 xmax = HeapTupleGetUpdateXid (tuple );
972- if (!TransactionIdIsValid (xmax ))
973- return true;
978+
979+ /* not LOCKED_ONLY, so it has to have an xmax */
980+ Assert (TransactionIdIsValid (xmax ));
981+
974982 if (TransactionIdIsCurrentTransactionId (xmax ))
975983 return false;
976984 if (TransactionIdIsInProgress (xmax ))
@@ -980,6 +988,7 @@ HeapTupleSatisfiesDirty(HeapTupleHeader tuple, Snapshot snapshot,
980988 }
981989 if (TransactionIdDidCommit (xmax ))
982990 return false;
991+ /* it must have aborted or crashed */
983992 return true;
984993 }
985994
@@ -1104,8 +1113,9 @@ HeapTupleSatisfiesMVCC(HeapTupleHeader tuple, Snapshot snapshot,
11041113 TransactionId xmax ;
11051114
11061115 xmax = HeapTupleGetUpdateXid (tuple );
1107- if (!TransactionIdIsValid (xmax ))
1108- return true;
1116+
1117+ /* not LOCKED_ONLY, so it has to have an xmax */
1118+ Assert (TransactionIdIsValid (xmax ));
11091119
11101120 /* updating subtransaction must have aborted */
11111121 if (!TransactionIdIsCurrentTransactionId (xmax ))
@@ -1164,8 +1174,10 @@ HeapTupleSatisfiesMVCC(HeapTupleHeader tuple, Snapshot snapshot,
11641174 Assert (!HEAP_XMAX_IS_LOCKED_ONLY (tuple -> t_infomask ));
11651175
11661176 xmax = HeapTupleGetUpdateXid (tuple );
1167- if (!TransactionIdIsValid (xmax ))
1168- return true;
1177+
1178+ /* not LOCKED_ONLY, so it has to have an xmax */
1179+ Assert (TransactionIdIsValid (xmax ));
1180+
11691181 if (TransactionIdIsCurrentTransactionId (xmax ))
11701182 {
11711183 if (HeapTupleHeaderGetCmax (tuple ) >= snapshot -> curcid )
@@ -1182,6 +1194,7 @@ HeapTupleSatisfiesMVCC(HeapTupleHeader tuple, Snapshot snapshot,
11821194 return true; /* treat as still in progress */
11831195 return false;
11841196 }
1197+ /* it must have aborted or crashed */
11851198 return true;
11861199 }
11871200
@@ -1376,8 +1389,10 @@ HeapTupleSatisfiesVacuum(HeapTupleHeader tuple, TransactionId OldestXmin,
13761389 Assert (!HEAP_XMAX_IS_LOCKED_ONLY (tuple -> t_infomask ));
13771390
13781391 xmax = HeapTupleGetUpdateXid (tuple );
1379- if (!TransactionIdIsValid (xmax ))
1380- return HEAPTUPLE_LIVE ;
1392+
1393+ /* not LOCKED_ONLY, so it has to have an xmax */
1394+ Assert (TransactionIdIsValid (xmax ));
1395+
13811396 if (TransactionIdIsInProgress (xmax ))
13821397 return HEAPTUPLE_DELETE_IN_PROGRESS ;
13831398 else if (TransactionIdDidCommit (xmax ))
@@ -1390,8 +1405,10 @@ HeapTupleSatisfiesVacuum(HeapTupleHeader tuple, TransactionId OldestXmin,
13901405 Assert (!(tuple -> t_infomask & HEAP_XMAX_COMMITTED ));
13911406
13921407 xmax = HeapTupleGetUpdateXid (tuple );
1393- if (!TransactionIdIsValid (xmax ))
1394- return HEAPTUPLE_LIVE ;
1408+
1409+ /* not LOCKED_ONLY, so it has to have an xmax */
1410+ Assert (TransactionIdIsValid (xmax ));
1411+
13951412 /* multi is not running -- updating xact cannot be */
13961413 Assert (!TransactionIdIsInProgress (xmax ));
13971414 if (TransactionIdDidCommit (xmax ))
@@ -1401,22 +1418,13 @@ HeapTupleSatisfiesVacuum(HeapTupleHeader tuple, TransactionId OldestXmin,
14011418 else
14021419 return HEAPTUPLE_DEAD ;
14031420 }
1404- else
1405- {
1406- /*
1407- * Not in Progress, Not Committed, so either Aborted or crashed.
1408- */
1409- SetHintBits (tuple , buffer , HEAP_XMAX_INVALID , InvalidTransactionId );
1410- return HEAPTUPLE_LIVE ;
1411- }
14121421
14131422 /*
1414- * Deleter committed, but perhaps it was recent enough that some open
1415- * transactions could still see the tuple .
1423+ * Not in Progress, Not Committed, so either Aborted or crashed.
1424+ * Remove the Xmax .
14161425 */
1417-
1418- /* Otherwise, it's dead and removable */
1419- return HEAPTUPLE_DEAD ;
1426+ SetHintBits (tuple , buffer , HEAP_XMAX_INVALID , InvalidTransactionId );
1427+ return HEAPTUPLE_LIVE ;
14201428 }
14211429
14221430 if (!(tuple -> t_infomask & HEAP_XMAX_COMMITTED ))
@@ -1655,8 +1663,9 @@ HeapTupleHeaderIsOnlyLocked(HeapTupleHeader tuple)
16551663
16561664 /* ... but if it's a multi, then perhaps the updating Xid aborted. */
16571665 xmax = HeapTupleGetUpdateXid (tuple );
1658- if (!TransactionIdIsValid (xmax )) /* shouldn't happen .. */
1659- return true;
1666+
1667+ /* not LOCKED_ONLY, so it has to have an xmax */
1668+ Assert (TransactionIdIsValid (xmax ));
16601669
16611670 if (TransactionIdIsCurrentTransactionId (xmax ))
16621671 return false;
0 commit comments