From: Peter Geoghegan <pg@bowt.ie>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Avoid update conflict out serialization anomalies.
Date: Thu, 11 Jun 2020 17:11:07 +0000
Message-ID: <E1jjQjL-00011e-39@gemulon.postgresql.org> (raw)
Avoid update conflict out serialization anomalies.
SSI's HeapCheckForSerializableConflictOut() test failed to correctly
handle conditions involving a concurrently inserted tuple which is later
concurrently updated by a separate transaction . A SELECT statement
that called HeapCheckForSerializableConflictOut() could end up using the
same XID (updater's XID) for both the original tuple, and the successor
tuple, missing the XID of the xact that created the original tuple
entirely. This only happened when neither tuple from the chain was
visible to the transaction's MVCC snapshot.
The observable symptoms of this bug were subtle. A pair of transactions
could commit, with the later transaction failing to observe the effects
of the earlier transaction (because of the confusion created by the
update to the non-visible row). This bug dates all the way back to
commit dafaa3ef, which added SSI.
To fix, make sure that we check the xmin of concurrently inserted tuples
that happen to also have been updated concurrently.
Author: Peter Geoghegan
Reported-By: Kyle Kingsbury
Reviewed-By: Thomas Munro
Discussion: https://postgr.es/m/db7b729d-0226-d162-a126-8a8ab2dc4443@jepsen.io
Backpatch: All supported versions
Branch
------
REL_10_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/19a6e1bc30832dbfadc4e4ae2b29bbc756ce65a9
Modified Files
--------------
src/backend/storage/lmgr/predicate.c | 21 +++++++--
.../isolation/expected/update-conflict-out.out | 27 +++++++++++
src/test/isolation/isolation_schedule | 1 +
src/test/isolation/specs/update-conflict-out.spec | 54 ++++++++++++++++++++++
4 files changed, 98 insertions(+), 5 deletions(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: pg@bowt.ie
Subject: Re: pgsql: Avoid update conflict out serialization anomalies.
In-Reply-To: <E1jjQjL-00011e-39@gemulon.postgresql.org>
References: <E1jjQjL-00011e-39@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox