Re: pgsql: Fix traversal of half-frozen update chains

From: Peter Geoghegan <pg(at)bowt(dot)ie>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: pgsql-committers <pgsql-committers(at)postgresql(dot)org>
Subject: Re: pgsql: Fix traversal of half-frozen update chains
Date: 2017-10-17 19:24:58
Message-ID: CAH2-Wz=vhurcDjg_u_JgqNmp5_Ge2nRJwMHdbP=dGgfzd50pTA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On Tue, Oct 17, 2017 at 12:23 PM, Peter Geoghegan <pg(at)bowt(dot)ie> wrote:
> On Tue, Oct 17, 2017 at 3:40 AM, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> wrote:
>> Peter Geoghegan wrote:
>>
>>> Wouldn't this last "if" test, to cover the pg_upgrade case, be better
>>> targeted by comparing *raw* xmin to FrozenTransactionId? You're using
>>> the potentially distinct xmin value returned by
>>> HeapTupleHeaderGetXmin() for the test here. I think we should be
>>> directly targeting tuples frozen on or before 9.4 (prior to
>>> pg_upgrade) instead.
>>
>> I also realized we can stop checking (i.e. don't compare xmin to
>> frozenxid) if the XMIN_FROZEN bits are set -- because in that case the
>> tuple cannot possibly come from 9.3 frozen. So I think this should do
>> it.
>>
>> (New HeapTupleUpdateXmaxMatchesXmin() implementation)
>
> Yeah, this is what I had in mind, too.

BTW, seems worth fixing this old comment above
heap_prepare_freeze_tuple() while you're at it:

* NB: It is not enough to set hint bits to indicate something is
* committed/invalid -- they might not be set on a standby, or after crash
* recovery. We really need to remove old xids.

--
Peter Geoghegan

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Geoghegan 2017-10-17 19:42:25 Re: [COMMITTERS] pgsql: Fix traversal of half-frozen update chains
Previous Message Peter Geoghegan 2017-10-17 19:23:19 Re: pgsql: Fix traversal of half-frozen update chains

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2017-10-17 19:42:25 Re: [COMMITTERS] pgsql: Fix traversal of half-frozen update chains
Previous Message Peter Geoghegan 2017-10-17 19:23:19 Re: pgsql: Fix traversal of half-frozen update chains