Re: New vacuum option to do only freezing - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: New vacuum option to do only freezing
Date
Msg-id 20190502160335.GA17452@alvherre.pgsql
Whole thread Raw
In response to Re: New vacuum option to do only freezing  (Andres Freund <andres@anarazel.de>)
Responses Re: New vacuum option to do only freezing
List pgsql-hackers
On 2019-May-01, Andres Freund wrote:

> Alvaro, could we perhaps clean this up a bit? This is pretty confusing
> looking.  I think this probably could just be changed to
> 
>         bool            xmin_frozen = false;
> 
>         xid = HeapTupleHeaderGetXmin(tuple);
> 
>         if (xid == FrozenTransactionId)
>                 xmin_frozen = true;
>         else if (TransactionIdIsNormal(xid))
> 
> or somesuch.  There's no need to check for
> HeapTupleHeaderXminFrozen(tuple) etc, because HeapTupleHeaderGetXmin()
> already does so - and if it didn't, the issue Tom points out would be
> problematic.

Ah, yeah, that's simpler.  I would like to introduce a couple of very
minor changes to the proposed style, per the attached.

* don't initialize xmin_frozen at all; rather, only set its value to the
correct one when we have determined what it is.  Doing premature
initialization is what led to some of those old bugs, so I prefer not to
do it.

* Handle the BootstrapXid and InvalidXid cases explicitly, by setting
xmin_frozen to true when xmin is not normal.  After all, those XID
values do not need any freezing.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachment

pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: New vacuum option to do only freezing
Next
From: Antonin Houska
Date:
Subject: Re: Attempt to consolidate reading of XLOG page