pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Heikki Linnakangas <heikki.linnakangas@iki.fi>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix race condition in committing a serializable transaction
Date: Mon, 21 Oct 2024 08:01:19 +0000
Message-ID: <E1t2nLr-001jdR-GU@gemulon.postgresql.org> (raw)

Fix race condition in committing a serializable transaction

The finished transaction list can contain XIDs that are older than the
serializable global xmin. It's a short-lived state;
ClearOldPredicateLocks() removes any such transactions from the list,
and it's called whenever the global xmin advances. But if another
backend calls SummarizeOldestCommittedSxact() in that window, it will
call SerialAdd() on an XID that's older than the global xmin, or if
there are no more transactions running, when global xmin is
invalid. That trips the assertion in SerialAdd().

Fixes bug #18658 reported by Andrew Bille. Thanks to Alexander Lakhin
for analysis. Backpatch to all versions.

Discussion: https://www.postgresql.org/message-id/18658-7dab125ec688c70b%40postgresql.org

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/1a43de5e0a591b66ef3d92f3fac5aefcc2dc02fe

Modified Files
--------------
src/backend/storage/lmgr/predicate.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)



view thread (7+ messages)  latest in thread

Message-ID: <E1t2nLr-001jdR-GU@gemulon.postgresql.org>
Permalink:  ../E1t2nLr-001jdR-GU@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1t2nLr-001jdR-GU@gemulon.postgresql.org

 · 

reply

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 using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: heikki.linnakangas@iki.fi, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Fix race condition in committing a serializable transaction
  In-Reply-To: <E1t2nLr-001jdR-GU@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