frz->t_infomask = tuple->t_infomask;
frz->xmax = HeapTupleHeaderGetRawXmax(tuple);
- /* Process xmin */
+ /*
+ * Process xmin. xmin_frozen has two slightly different meanings: in the
+ * !XidIsNormal case, it means "the xmin doesn't need any freezing" (it's
+ * already a permanent value), while in the block below it is set true to
+ * mean "xmin won't need freezing after what we do to it here" (false
+ * otherwise). In both cases we're allowed to set totally_frozen, as far
+ * as xmin is concerned.
+ */
xid = HeapTupleHeaderGetXmin(tuple);
- xmin_frozen = ((xid == FrozenTransactionId) ||
- HeapTupleHeaderXminFrozen(tuple));
- if (TransactionIdIsNormal(xid))
+ if (!TransactionIdIsNormal(xid))
+ xmin_frozen = true;
+ else
{
if (TransactionIdPrecedes(xid, relfrozenxid))
ereport(ERROR,
errmsg_internal("found xmin %u from before relfrozenxid %u",
xid, relfrozenxid)));
- if (TransactionIdPrecedes(xid, cutoff_xid))
+ xmin_frozen = TransactionIdPrecedes(xid, cutoff_xid);
+ if (xmin_frozen)
{
if (!TransactionIdDidCommit(xid))
ereport(ERROR,
frz->t_infomask |= HEAP_XMIN_FROZEN;
changed = true;
- xmin_frozen = true;
}
}