Re: pgsql: Fix WAL replay of locking an updated tuple - Mailing list pgsql-committers

From Andres Freund
Subject Re: pgsql: Fix WAL replay of locking an updated tuple
Date
Msg-id 20140227144745.GH28858@alap3.anarazel.de
Whole thread Raw
In response to Re: pgsql: Fix WAL replay of locking an updated tuple  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-committers
On 2014-02-27 09:41:03 -0500, Tom Lane wrote:
> Alvaro Herrera <alvherre@alvh.no-ip.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


pgsql-committers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: pgsql: Fix WAL replay of locking an updated tuple
Next
From: Tom Lane
Date:
Subject: pgsql: Remove dependency on database encoding in citext regression test