diff options
Diffstat (limited to 'src/backend')
-rw-r--r-- | src/backend/storage/ipc/dsm.c | 9 | ||||
-rw-r--r-- | src/backend/storage/ipc/dsm_impl.c | 6 |
2 files changed, 11 insertions, 4 deletions
diff --git a/src/backend/storage/ipc/dsm.c b/src/backend/storage/ipc/dsm.c index e9e9fae3eb..ce6f07d4c5 100644 --- a/src/backend/storage/ipc/dsm.c +++ b/src/backend/storage/ipc/dsm.c @@ -397,6 +397,7 @@ static void dsm_backend_startup(void) { #ifdef EXEC_BACKEND + if (IsUnderPostmaster) { void *control_address = NULL; @@ -496,8 +497,12 @@ dsm_create(Size size, int flags) FreePageManager *dsm_main_space_fpm = dsm_main_space_begin; bool using_main_dsm_region = false; - /* Unsafe in postmaster (and pointless in a stand-alone backend). */ - Assert(IsUnderPostmaster); + /* + * Unsafe in postmaster. It might seem pointless to allow use of dsm in + * single user mode, but otherwise some subsystems will need dedicated + * single user mode code paths. + */ + Assert(IsUnderPostmaster || !IsPostmasterEnvironment); if (!dsm_init_done) dsm_backend_startup(); diff --git a/src/backend/storage/ipc/dsm_impl.c b/src/backend/storage/ipc/dsm_impl.c index 49f4c98620..873867e856 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; |