agora inbox for pgsql-committers@postgresql.org
help / color / mirror / Atom feedFrom: Peter Geoghegan <pg@bowt.ie>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix another empty nbtree index SSI race.
Date: Sat, 25 Jul 2026 16:01:57 +0000
Message-ID: <E1wnep3-00000000GoQ-3yGf@gemulon.postgresql.org> (raw)
Fix another empty nbtree index SSI race.
Commit f9b7fc65 fixed a race when predicate-locking completely empty
btrees: without a buffer lock held, a matching key could be inserted
between _bt_search and the PredicateLockRelation call, so the scan would
miss concurrently inserted tuples while the writer wouldn't see the
reader's predicate lock. That commit only fixed _bt_first's _bt_search
path, though. Scans without useful insertion scan keys return early
from _bt_first via _bt_endpoint, which still didn't recheck if the
relation was empty.
To fix, add handling to _bt_endpoint that is analogous to the handling
added to _bt_search by commit f9b7fc65.
Author: Peter Geoghegan <pg@bowt.ie>
Discussion: https://postgr.es/m/CAH2-WzkNoTn3yXY0iGkSuavJ+sL8EROf+kitW+_2v2tJVWuKmA@mail.gmail.com
Backpatch-through: 14
Branch
------
REL_15_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/5d18105cadb0ef5b937fe388eb4b109e4396b16f
Modified Files
--------------
src/backend/access/nbtree/nbtsearch.c | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
view thread (7+ messages) latest in thread
Message-ID: <E1wnep3-00000000GoQ-3yGf@gemulon.postgresql.org>
Permalink: ../E1wnep3-00000000GoQ-3yGf@gemulon.postgresql.org/
Also on: postgresql.org/message-id/E1wnep3-00000000GoQ-3yGf@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: pg@bowt.ie, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Fix another empty nbtree index SSI race.
In-Reply-To: <E1wnep3-00000000GoQ-3yGf@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 agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox