agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
pgsql: Fix another empty nbtree index SSI race.
7+ messages / 1 participants
[nested] [flat]

* pgsql: Fix another empty nbtree index SSI race.
@ 2026-07-25 16:01 Peter Geoghegan <pg@bowt.ie>
  0 siblings, 0 replies; 7+ messages in thread

From: Peter Geoghegan @ 2026-07-25 16:01 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/ce3f19e26218283eaff6436e28113b532bfc4a6f

Modified Files
--------------
src/backend/access/nbtree/nbtsearch.c | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Fix another empty nbtree index SSI race.
@ 2026-07-25 16:01 Peter Geoghegan <pg@bowt.ie>
  0 siblings, 0 replies; 7+ messages in thread

From: Peter Geoghegan @ 2026-07-25 16:01 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/2aa3c6d1fceecd94b1f605f0c62884cb686e67ed

Modified Files
--------------
src/backend/access/nbtree/nbtsearch.c | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Fix another empty nbtree index SSI race.
@ 2026-07-25 16:01 Peter Geoghegan <pg@bowt.ie>
  0 siblings, 0 replies; 7+ messages in thread

From: Peter Geoghegan @ 2026-07-25 16:01 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/d560e730e813343b8d3f4a336244f2bc09ca84fc

Modified Files
--------------
src/backend/access/nbtree/nbtsearch.c | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Fix another empty nbtree index SSI race.
@ 2026-07-25 16:01 Peter Geoghegan <pg@bowt.ie>
  0 siblings, 0 replies; 7+ messages in thread

From: Peter Geoghegan @ 2026-07-25 16:01 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/8434c938598d64f972aceb564104397787a21997

Modified Files
--------------
src/backend/access/nbtree/nbtsearch.c | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Fix another empty nbtree index SSI race.
@ 2026-07-25 16:01 Peter Geoghegan <pg@bowt.ie>
  0 siblings, 0 replies; 7+ messages in thread

From: Peter Geoghegan @ 2026-07-25 16:01 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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_16_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/e321faaaef54cd1b93186046d4c98b43a59a8f1e

Modified Files
--------------
src/backend/access/nbtree/nbtsearch.c | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Fix another empty nbtree index SSI race.
@ 2026-07-25 16:01 Peter Geoghegan <pg@bowt.ie>
  0 siblings, 0 replies; 7+ messages in thread

From: Peter Geoghegan @ 2026-07-25 16:01 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Fix another empty nbtree index SSI race.
@ 2026-07-25 16:01 Peter Geoghegan <pg@bowt.ie>
  0 siblings, 0 replies; 7+ messages in thread

From: Peter Geoghegan @ 2026-07-25 16:01 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/2fc3e1b44a4b4bb9b01adced7b040b51dc9606a0

Modified Files
--------------
src/backend/access/nbtree/nbtsearch.c | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread


end of thread, other threads:[~2026-07-25 16:01 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-07-25 16:01 pgsql: Fix another empty nbtree index SSI race. Peter Geoghegan <pg@bowt.ie>
2026-07-25 16:01 pgsql: Fix another empty nbtree index SSI race. Peter Geoghegan <pg@bowt.ie>
2026-07-25 16:01 pgsql: Fix another empty nbtree index SSI race. Peter Geoghegan <pg@bowt.ie>
2026-07-25 16:01 pgsql: Fix another empty nbtree index SSI race. Peter Geoghegan <pg@bowt.ie>
2026-07-25 16:01 pgsql: Fix another empty nbtree index SSI race. Peter Geoghegan <pg@bowt.ie>
2026-07-25 16:01 pgsql: Fix another empty nbtree index SSI race. Peter Geoghegan <pg@bowt.ie>
2026-07-25 16:01 pgsql: Fix another empty nbtree index SSI race. Peter Geoghegan <pg@bowt.ie>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox