Re: pgsql: Fix WAL replay of locking an updated tuple

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, pgsql-committers(at)postgresql(dot)org
Subject: Re: pgsql: Fix WAL replay of locking an updated tuple
Date: 2014-02-27 14:47:45
Message-ID: 20140227144745.GH28858@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

On 2014-02-27 09:41:03 -0500, Tom Lane wrote:
> Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> writes:
> > Fix WAL replay of locking an updated tuple
>
> The test added by this patch certainly looks like it's backwards.
> Shouldn't you be clearing HOT_UPDATED only if the tuple is *not*
> XMAX_IS_LOCKED_ONLY?

If it's not XMAX_IS_LOCKED_ONLY, we're locking the last tuple in the
ctid chain, so there is no need for t_ctid to point anywhere. If it's
not, there are later tuples (which the locking backend can't see yet
because of its snapshot) but which haven't changed the key and thus only
have NO KEY UPDATE lock level.

The bug exactly was that the ctid chain was destroyed when there were
later tuples.

Greetings,

Andres Freund

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2014-02-27 19:58:54 pgsql: Remove dependency on database encoding in citext regression test
Previous Message Alvaro Herrera 2014-02-27 14:47:27 Re: pgsql: Fix WAL replay of locking an updated tuple