@@ -223,8 +223,9 @@ HeapTupleSatisfiesSelf(HeapTuple htup, Snapshot snapshot, Buffer buffer)
223
223
TransactionId xmax ;
224
224
225
225
xmax = HeapTupleGetUpdateXid (tuple );
226
- if (!TransactionIdIsValid (xmax ))
227
- return true;
226
+
227
+ /* not LOCKED_ONLY, so it has to have an xmax */
228
+ Assert (TransactionIdIsValid (xmax ));
228
229
229
230
/* updating subtransaction must have aborted */
230
231
if (!TransactionIdIsCurrentTransactionId (xmax ))
@@ -277,14 +278,17 @@ HeapTupleSatisfiesSelf(HeapTuple htup, Snapshot snapshot, Buffer buffer)
277
278
return true;
278
279
279
280
xmax = HeapTupleGetUpdateXid (tuple );
280
- if (!TransactionIdIsValid (xmax ))
281
- return true;
281
+
282
+ /* not LOCKED_ONLY, so it has to have an xmax */
283
+ Assert (TransactionIdIsValid (xmax ));
284
+
282
285
if (TransactionIdIsCurrentTransactionId (xmax ))
283
286
return false;
284
287
if (TransactionIdIsInProgress (xmax ))
285
288
return true;
286
289
if (TransactionIdDidCommit (xmax ))
287
290
return false;
291
+ /* it must have aborted or crashed */
288
292
return true;
289
293
}
290
294
@@ -497,8 +501,9 @@ HeapTupleSatisfiesUpdate(HeapTuple htup, CommandId curcid,
497
501
TransactionId xmax ;
498
502
499
503
xmax = HeapTupleGetUpdateXid (tuple );
500
- if (!TransactionIdIsValid (xmax ))
501
- return HeapTupleMayBeUpdated ;
504
+
505
+ /* not LOCKED_ONLY, so it has to have an xmax */
506
+ Assert (TransactionIdIsValid (xmax ));
502
507
503
508
/* updating subtransaction must have aborted */
504
509
if (!TransactionIdIsCurrentTransactionId (xmax ))
@@ -573,14 +578,9 @@ HeapTupleSatisfiesUpdate(HeapTuple htup, CommandId curcid,
573
578
}
574
579
575
580
xmax = HeapTupleGetUpdateXid (tuple );
576
- if (!TransactionIdIsValid (xmax ))
577
- {
578
- if (MultiXactIdIsRunning (HeapTupleHeaderGetRawXmax (tuple )))
579
- return HeapTupleBeingUpdated ;
580
581
581
- SetHintBits (tuple , buffer , HEAP_XMAX_INVALID , InvalidTransactionId );
582
- return HeapTupleMayBeUpdated ;
583
- }
582
+ /* not LOCKED_ONLY, so it has to have an xmax */
583
+ Assert (TransactionIdIsValid (xmax ));
584
584
585
585
if (TransactionIdIsCurrentTransactionId (xmax ))
586
586
{
@@ -590,13 +590,18 @@ HeapTupleSatisfiesUpdate(HeapTuple htup, CommandId curcid,
590
590
return HeapTupleInvisible ; /* updated before scan started */
591
591
}
592
592
593
- if (MultiXactIdIsRunning ( HeapTupleHeaderGetRawXmax ( tuple ) ))
593
+ if (TransactionIdIsInProgress ( xmax ))
594
594
return HeapTupleBeingUpdated ;
595
595
596
596
if (TransactionIdDidCommit (xmax ))
597
597
return HeapTupleUpdated ;
598
+
599
+ /* no member, even just a locker, alive anymore */
600
+ if (!MultiXactIdIsRunning (HeapTupleHeaderGetRawXmax (tuple )))
601
+ SetHintBits (tuple , buffer , HEAP_XMAX_INVALID ,
602
+ InvalidTransactionId );
603
+
598
604
/* it must have aborted or crashed */
599
- SetHintBits (tuple , buffer , HEAP_XMAX_INVALID , InvalidTransactionId );
600
605
return HeapTupleMayBeUpdated ;
601
606
}
602
607
@@ -722,8 +727,9 @@ HeapTupleSatisfiesDirty(HeapTuple htup, Snapshot snapshot,
722
727
TransactionId xmax ;
723
728
724
729
xmax = HeapTupleGetUpdateXid (tuple );
725
- if (!TransactionIdIsValid (xmax ))
726
- return true;
730
+
731
+ /* not LOCKED_ONLY, so it has to have an xmax */
732
+ Assert (TransactionIdIsValid (xmax ));
727
733
728
734
/* updating subtransaction must have aborted */
729
735
if (!TransactionIdIsCurrentTransactionId (xmax ))
@@ -780,8 +786,10 @@ HeapTupleSatisfiesDirty(HeapTuple htup, Snapshot snapshot,
780
786
return true;
781
787
782
788
xmax = HeapTupleGetUpdateXid (tuple );
783
- if (!TransactionIdIsValid (xmax ))
784
- return true;
789
+
790
+ /* not LOCKED_ONLY, so it has to have an xmax */
791
+ Assert (TransactionIdIsValid (xmax ));
792
+
785
793
if (TransactionIdIsCurrentTransactionId (xmax ))
786
794
return false;
787
795
if (TransactionIdIsInProgress (xmax ))
@@ -791,6 +799,7 @@ HeapTupleSatisfiesDirty(HeapTuple htup, Snapshot snapshot,
791
799
}
792
800
if (TransactionIdDidCommit (xmax ))
793
801
return false;
802
+ /* it must have aborted or crashed */
794
803
return true;
795
804
}
796
805
@@ -915,8 +924,9 @@ HeapTupleSatisfiesMVCC(HeapTuple htup, Snapshot snapshot,
915
924
TransactionId xmax ;
916
925
917
926
xmax = HeapTupleGetUpdateXid (tuple );
918
- if (!TransactionIdIsValid (xmax ))
919
- return true;
927
+
928
+ /* not LOCKED_ONLY, so it has to have an xmax */
929
+ Assert (TransactionIdIsValid (xmax ));
920
930
921
931
/* updating subtransaction must have aborted */
922
932
if (!TransactionIdIsCurrentTransactionId (xmax ))
@@ -975,8 +985,10 @@ HeapTupleSatisfiesMVCC(HeapTuple htup, Snapshot snapshot,
975
985
Assert (!HEAP_XMAX_IS_LOCKED_ONLY (tuple -> t_infomask ));
976
986
977
987
xmax = HeapTupleGetUpdateXid (tuple );
978
- if (!TransactionIdIsValid (xmax ))
979
- return true;
988
+
989
+ /* not LOCKED_ONLY, so it has to have an xmax */
990
+ Assert (TransactionIdIsValid (xmax ));
991
+
980
992
if (TransactionIdIsCurrentTransactionId (xmax ))
981
993
{
982
994
if (HeapTupleHeaderGetCmax (tuple ) >= snapshot -> curcid )
@@ -993,6 +1005,7 @@ HeapTupleSatisfiesMVCC(HeapTuple htup, Snapshot snapshot,
993
1005
return true; /* treat as still in progress */
994
1006
return false;
995
1007
}
1008
+ /* it must have aborted or crashed */
996
1009
return true;
997
1010
}
998
1011
@@ -1191,8 +1204,10 @@ HeapTupleSatisfiesVacuum(HeapTuple htup, TransactionId OldestXmin,
1191
1204
Assert (!HEAP_XMAX_IS_LOCKED_ONLY (tuple -> t_infomask ));
1192
1205
1193
1206
xmax = HeapTupleGetUpdateXid (tuple );
1194
- if (!TransactionIdIsValid (xmax ))
1195
- return HEAPTUPLE_LIVE ;
1207
+
1208
+ /* not LOCKED_ONLY, so it has to have an xmax */
1209
+ Assert (TransactionIdIsValid (xmax ));
1210
+
1196
1211
if (TransactionIdIsInProgress (xmax ))
1197
1212
return HEAPTUPLE_DELETE_IN_PROGRESS ;
1198
1213
else if (TransactionIdDidCommit (xmax ))
@@ -1205,8 +1220,10 @@ HeapTupleSatisfiesVacuum(HeapTuple htup, TransactionId OldestXmin,
1205
1220
Assert (!(tuple -> t_infomask & HEAP_XMAX_COMMITTED ));
1206
1221
1207
1222
xmax = HeapTupleGetUpdateXid (tuple );
1208
- if (!TransactionIdIsValid (xmax ))
1209
- return HEAPTUPLE_LIVE ;
1223
+
1224
+ /* not LOCKED_ONLY, so it has to have an xmax */
1225
+ Assert (TransactionIdIsValid (xmax ));
1226
+
1210
1227
/* multi is not running -- updating xact cannot be */
1211
1228
Assert (!TransactionIdIsInProgress (xmax ));
1212
1229
if (TransactionIdDidCommit (xmax ))
@@ -1216,22 +1233,13 @@ HeapTupleSatisfiesVacuum(HeapTuple htup, TransactionId OldestXmin,
1216
1233
else
1217
1234
return HEAPTUPLE_DEAD ;
1218
1235
}
1219
- else
1220
- {
1221
- /*
1222
- * Not in Progress, Not Committed, so either Aborted or crashed.
1223
- */
1224
- SetHintBits (tuple , buffer , HEAP_XMAX_INVALID , InvalidTransactionId );
1225
- return HEAPTUPLE_LIVE ;
1226
- }
1227
1236
1228
1237
/*
1229
- * Deleter committed, but perhaps it was recent enough that some open
1230
- * transactions could still see the tuple .
1238
+ * Not in Progress, Not Committed, so either Aborted or crashed.
1239
+ * Remove the Xmax .
1231
1240
*/
1232
-
1233
- /* Otherwise, it's dead and removable */
1234
- return HEAPTUPLE_DEAD ;
1241
+ SetHintBits (tuple , buffer , HEAP_XMAX_INVALID , InvalidTransactionId );
1242
+ return HEAPTUPLE_LIVE ;
1235
1243
}
1236
1244
1237
1245
if (!(tuple -> t_infomask & HEAP_XMAX_COMMITTED ))
@@ -1474,8 +1482,9 @@ HeapTupleHeaderIsOnlyLocked(HeapTupleHeader tuple)
1474
1482
1475
1483
/* ... but if it's a multi, then perhaps the updating Xid aborted. */
1476
1484
xmax = HeapTupleGetUpdateXid (tuple );
1477
- if (!TransactionIdIsValid (xmax )) /* shouldn't happen .. */
1478
- return true;
1485
+
1486
+ /* not LOCKED_ONLY, so it has to have an xmax */
1487
+ Assert (TransactionIdIsValid (xmax ));
1479
1488
1480
1489
if (TransactionIdIsCurrentTransactionId (xmax ))
1481
1490
return false;
0 commit comments