postgresql/src
Thomas Munro f9b7fc651a Fix race in SSI interaction with empty btrees.
When predicate-locking btrees, we have a special case for completely
empty btrees, since there is no page to lock.  This was racy, because,
without buffer lock held, a matching key could be inserted between the
_bt_search() and the PredicateLockRelation() calls.

Fix, by rechecking _bt_search() after taking the relation-level SIREAD
lock, if using SERIALIZABLE isolation and an empty btree is discovered.

Back-patch to all supported releases.  Fixes one aspect of bug #17949.

Reported-by: Artem Anisimov <artem.anisimov.255@gmail.com>
Reviewed-by: Dmitry Dolgov <9erthalion6@gmail.com>
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>
Discussion: https://postgr.es/m/17949-a0f17035294a55e2%40postgresql.org
2023-07-04 09:07:31 +12:00
..
backend Fix race in SSI interaction with empty btrees. 2023-07-04 09:07:31 +12:00
bin Improve pg_basebackup long file name test Windows robustness 2023-07-03 10:06:26 -04:00
common meson: Add dependencies to perl modules to various script invocations 2023-06-09 20:12:16 -07:00
fe_utils Pre-beta mechanical code beautification. 2023-05-19 17:24:48 -04:00
include Update PG_CACHE_LINE_SIZE description. 2023-07-03 11:56:30 +03:00
interfaces Remove support for OpenSSL 1.0.1 2023-07-03 13:20:27 +09:00
makefiles Use --strip-unneeded when stripping static libraries with GNU strip. 2023-04-20 18:12:32 -04:00
pl Translation updates 2023-06-26 12:02:02 +02:00
port Pre-beta mechanical code beautification. 2023-05-19 17:24:48 -04:00
template Use unnamed POSIX semaphores on Cygwin. 2023-01-06 10:33:28 +13:00
test Remove support for OpenSSL 1.0.1 2023-07-03 13:20:27 +09:00
timezone Pre-beta mechanical code beautification. 2023-05-19 17:24:48 -04:00
tools Remove support for OpenSSL 1.0.1 2023-07-03 13:20:27 +09:00
tutorial Pre-beta mechanical code beautification. 2023-05-19 17:24:48 -04:00
.gitignore
DEVELOPERS
Makefile Integrate pg_bsd_indent into our build/test infrastructure. 2023-02-12 12:22:21 -05:00
Makefile.global.in Fix prove_installcheck when used with PGXS 2023-05-05 07:09:52 +02:00
Makefile.shlib autoconf: Rely on ar supporting index creation 2022-10-07 11:53:39 -07:00
meson.build Integrate pg_bsd_indent into our build/test infrastructure. 2023-02-12 12:22:21 -05:00
nls-global.mk Fix for make unportability 2022-07-13 09:15:01 +02:00