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

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Peter Geoghegan <pg(at)bowt(dot)ie>
Cc: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, "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-19 14:21:12
Message-ID: CA+TgmoZLXqCc_w7OLsgU8PEBp89JymOprA3rSDnQ=E8ajmi7Vg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On Wed, Oct 18, 2017 at 5:52 PM, Peter Geoghegan <pg(at)bowt(dot)ie> wrote:
> There is a race where we cannot prune the page, though. That's why we
> had to revisit what I suppose was a tacit assumption, and address its
> problems in the commit that started this thread (commit a5736bf7).

The commit message for a5736bf7 doesn't say anything about a race; it
just claims that it is fixing traversal of half-frozen update chains,
without making any reference to how such a thing as a half-frozen
update chain came to exist in the first place. I think the commit
that talks about that race condition is 20b65522.

/me studies the problem for a while.

What's bothering me about this is: how is cutoff_xid managing to be a
new enough transaction ID for this to happen in the first place? The
cutoff XID should certainly be older than anything any current
snapshot can see, because it's computed using GetOldestXmin() -- which
means that XIDs older than the cutoff can't still be running (except
maybe if old_snapshot_threshold is set to a non-default value). And
that means that the state of any tuple to which
heap_prepare_freeze_tuple() does anything shouldn't be able to change
between the time the HOT-prune is done and the time freezing is
completed. To put that the other way around, an xmin or xmax that was
still running when we did the HOT prune should also be too new to get
frozen.

--
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 Tom Lane 2017-10-19 15:16:23 pgsql: Fix incorrect link in v10 release notes.
Previous Message Alvaro Herrera 2017-10-19 12:22:38 pgsql: Add more tests for reloptions

Browse pgsql-hackers by date

  From Date Subject
Next Message Aleksandr Parfenov 2017-10-19 14:24:09 Flexible configuration for full-text search
Previous Message David Fetter 2017-10-19 14:15:38 Re: Cursor With_Hold Performance Workarounds/Optimization