From: | Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> |
---|---|
To: | Andres Freund <andres(at)anarazel(dot)de> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>, "Bossart, Nathan" <bossartn(at)amazon(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: New vacuum option to do only freezing |
Date: | 2019-05-02 16:03:35 |
Message-ID: | 20190502160335.GA17452@alvherre.pgsql |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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 | Content-Type | Size |
---|---|---|
0001-heap_prepare_freeze_tuple-Simplify-coding.patch | text/x-diff | 1.4 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Antonin Houska | 2019-05-02 16:17:36 | Re: Attempt to consolidate reading of XLOG page |
Previous Message | Robert Haas | 2019-05-02 16:02:59 | Re: New vacuum option to do only freezing |