If a transaction marks a tuple for update and later commits without
actually having updated the tuple, do we still need the information
that the tuple has once been reserved for an update or can we simply
set the HEAP_XMAX_INVALID hint bit of the tuple?

In other words, is this snippet from a patch I'm working on a valid
modification to HeapTupleSatisfiesVacuum in tqual.c?

        if (TransactionIdIsInProgress(HeapTupleHeaderGetXmax(tuple)))
            return HEAPTUPLE_LIVE;
-           if (TransactionIdDidCommit(HeapTupleHeaderGetXmax(tuple)))
-               tuple->t_infomask |= HEAP_XMAX_COMMITTED;
-           else
-/* it's either aborted or crashed */
-               tuple->t_infomask |= HEAP_XMAX_INVALID;
+           /*
+            * We don't really care whether xmax did commit, abort or
+            * crash. We know that xmax did mark the tuple for update,
+            * but it did not and will never actually update it.
+            */
+           tuple->t_infomask |= HEAP_XMAX_INVALID;
    return HEAPTUPLE_LIVE;

There are a few more places in tqual.c which could be simplified like


---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?


Reply via email to