summaryrefslogtreecommitdiff
path: root/src/backend/storage/ipc/dsm.c
diff options
context:
space:
mode:
authorAndres Freund <andres@anarazel.de>2022-04-06 12:40:04 -0700
committerAndres Freund <andres@anarazel.de>2022-04-06 12:40:04 -0700
commit46a2d2499a647174585fcfe871ddd2d32244a128 (patch)
tree5b16ac881907dc56419e24be24ae476bbb897d24 /src/backend/storage/ipc/dsm.c
parente99546f56670491370d7dc63b0693c3aadaa3112 (diff)
downloadpostgresql-46a2d2499a647174585fcfe871ddd2d32244a128.tar.gz
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.c')
-rw-r--r--src/backend/storage/ipc/dsm.c9
1 files changed, 7 insertions, 2 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();