Fix Xmax freeze conditions
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Fri, 8 Feb 2013 04:27:54 +0000 (01:27 -0300)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Fri, 8 Feb 2013 15:50:58 +0000 (12:50 -0300)
I broke this in 0ac5ad5134; previously, freezing a tuple marked with an
IS_MULTI xmax was not necessary.

Per brokenness report from Jeff Janes.

src/backend/access/heap/heapam.c

index 39c3ee27559e32fac8ad513a9f7d780532ea7564..d2267266548005bd7cea624b56e5b6a849e6cbbb 100644 (file)
@@ -5113,10 +5113,11 @@ heap_freeze_tuple(HeapTupleHeader tuple, TransactionId cutoff_xid,
         * cutoff; it doesn't remove dead members of a very old multixact.
         */
        xid = HeapTupleHeaderGetRawXmax(tuple);
-       if (TransactionIdIsNormal(xid) &&
-               (((!(tuple->t_infomask & HEAP_XMAX_IS_MULTI) &&
-                  TransactionIdPrecedes(xid, cutoff_xid))) ||
-                MultiXactIdPrecedes(xid, cutoff_multi)))
+       if ((tuple->t_infomask & HEAP_XMAX_IS_MULTI) ?
+               (MultiXactIdIsValid(xid) &&
+                MultiXactIdPrecedes(xid, cutoff_multi)) :
+               (TransactionIdIsNormal(xid) &&
+                TransactionIdPrecedes(xid, cutoff_xid)))
        {
                HeapTupleHeaderSetXmax(tuple, InvalidTransactionId);