]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Fix min_dynamic_shared_memory on Windows.
authorThomas Munro <tmunro@postgresql.org>
Sat, 21 Oct 2023 21:04:55 +0000 (10:04 +1300)
committerThomas Munro <tmunro@postgresql.org>
Sat, 21 Oct 2023 21:05:59 +0000 (10:05 +1300)
commitfb9a16a1a6f24f5bbf05ca7a49bd4305575cc2f2
tree50138215be2441455bba5af0f595ed5688d40838
parent85c9dda818878149f3d248d5e09e03c4f26f436c
Fix min_dynamic_shared_memory on Windows.

When min_dynamic_shared_memory is set above 0, we try to find space in a
pre-allocated region of the main shared memory area instead of calling
dsm_impl_XXX() routines to allocate more.  The dsm_pin_segment() and
dsm_unpin_segment() routines had a bug: they called dsm_impl_XXX()
routines even for main region segments.  Nobody noticed before now
because those routines do nothing on Unix, but on Windows they'd fail
while attempting to duplicate an invalid Windows HANDLE.  Add the
missing gating.

Back-patch to 14, where commit 84b1c63a added this feature.  Fixes
pgsql-bugs bug #18165.

Reported-by: Maxime Boyer <maxime.boyer@cra-arc.gc.ca>
Tested-by: Alexander Lakhin <exclusion@gmail.com>
Discussion: https://postgr.es/m/18165-bf4f525cea6e51de%40postgresql.org
src/backend/storage/ipc/dsm.c