Re: [COMMITTERS] pgsql: Fix traversal of half-frozen update chains

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: Peter Geoghegan <pg(at)bowt(dot)ie>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [COMMITTERS] pgsql: Fix traversal of half-frozen update chains
Date: 2017-10-18 20:54:46
Message-ID: CA+TgmobEpCQ3TwH2RbLZUjR8aiSb0ZnbgPn7Tk3Fuke=4BPCJQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On Tue, Oct 17, 2017 at 6:02 AM, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> wrote:
> Robert Haas wrote:
>> I haven't really followed this thread in depth, but I'm very nervous
>> about the idea that we should ever be examining the raw-xmin of a
>> tuple that has been marked HEAP_XMIN_FROZEN for anything other than
>> forensic purposes.
>
> Yeah, me too. If you see another way to fix the problem, let's discuss
> it.

Well, I guess what I don't understand is, suppose we have a HOT chain
that looks like this, where [x,y] denotes a tuple with an xmin of x
and an xmax of y.

[a,b]->[b,c]->[c,d]

If b is eligible to be frozen, then b is committed and all-visible,
which means that the [a,b] tuple should be pruned altogether. IOW, I
don't think that a non-root tuple should ever have a frozen xmin; if
that happens, I think we've already screwed up. So I don't quite
understand how this problem arises in the first place.

I think that the way we are supposed to be guaranteeing this is to
first prune the page and then freeze it. If we ever freeze without
first pruning, I think that's a bug. Now it could be that the problem
is that there's a race: after we prune the page, somehow the xmin
horizon advances before we freeze. But that also seems like something
that shouldn't happen - our notion of the freeze threshold should be
frozen at the beginning of the scan and should not advance, and it
should be prior to our freeze horizon, which could be allowed to
advance but not retreat in the course of the scan.

Apologies if this is stupid; please clue me on what I'm missing.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Geoghegan 2017-10-18 21:52:41 Re: [COMMITTERS] pgsql: Fix traversal of half-frozen update chains
Previous Message Robert Haas 2017-10-18 19:07:20 Re: [COMMITTERS] pgsql: Implement table partitioning.

Browse pgsql-hackers by date

  From Date Subject
Next Message Nico Williams 2017-10-18 21:08:00 Re: Interest in a SECURITY DEFINER function current_user stack access mechanism?
Previous Message David G. Johnston 2017-10-18 20:43:30 Re: Interest in a SECURITY DEFINER function current_user stack access mechanism?