diff options
author | Andres Freund <andres@anarazel.de> | 2022-04-06 12:40:04 -0700 |
---|---|---|
committer | Andres Freund <andres@anarazel.de> | 2022-04-06 12:40:04 -0700 |
commit | 46a2d2499a647174585fcfe871ddd2d32244a128 (patch) | |
tree | 5b16ac881907dc56419e24be24ae476bbb897d24 /src/backend/storage/ipc/dsm_impl.c | |
parent | e99546f56670491370d7dc63b0693c3aadaa3112 (diff) | |
download | postgresql-46a2d2499a647174585fcfe871ddd2d32244a128.tar.gz postgresql-46a2d2499a647174585fcfe871ddd2d32244a128.zip |
dsm: allow use in single user mode.
It might seem pointless to allow use of dsm in single user mode, but otherwise
subsystems might need dedicated single user mode code paths.
Besides changing the assert, all that's needed is to make some windows code
assuming the presence of postmaster conditional.
Author: Andres Freund <andres@anarazel.de>
Reviewed-By: Thomas Munro <thomas.munro@gmail.com>
Discussion: https://postgr.es/m/CA+hUKGL9hY_VY=+oUK+Gc1iSRx-Ls5qeYJ6q=dQVZnT3R63Taw@mail.gmail.com
Diffstat (limited to 'src/backend/storage/ipc/dsm_impl.c')
-rw-r--r-- | src/backend/storage/ipc/dsm_impl.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/backend/storage/ipc/dsm_impl.c b/src/backend/storage/ipc/dsm_impl.c index 49f4c98620c..873867e8568 100644 --- a/src/backend/storage/ipc/dsm_impl.c +++ b/src/backend/storage/ipc/dsm_impl.c @@ -959,6 +959,7 @@ dsm_impl_pin_segment(dsm_handle handle, void *impl_private, { #ifdef USE_DSM_WINDOWS case DSM_IMPL_WINDOWS: + if (IsUnderPostmaster) { HANDLE hmap; @@ -984,8 +985,8 @@ dsm_impl_pin_segment(dsm_handle handle, void *impl_private, * is unpinned, dsm_impl_unpin_segment can close it. */ *impl_private_pm_handle = hmap; - break; } + break; #endif default: break; @@ -1008,6 +1009,7 @@ dsm_impl_unpin_segment(dsm_handle handle, void **impl_private) { #ifdef USE_DSM_WINDOWS case DSM_IMPL_WINDOWS: + if (IsUnderPostmaster) { if (*impl_private && !DuplicateHandle(PostmasterHandle, *impl_private, @@ -1025,8 +1027,8 @@ dsm_impl_unpin_segment(dsm_handle handle, void **impl_private) } *impl_private = NULL; - break; } + break; #endif default: break; |