Skip to content

Commit 565c97b

Browse files
committed
In a bootstrap process or standalone backend, set MaxBackends = 1
to avoid unnecessary consumption of semaphores.
1 parent edf497d commit 565c97b

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/backend/utils/init/postinit.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.116 2002/09/04 20:31:31 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.117 2002/10/03 19:19:09 tgl Exp $
1212
*
1313
*
1414
*-------------------------------------------------------------------------
@@ -172,11 +172,14 @@ InitCommunication(void)
172172
if (!IsUnderPostmaster) /* postmaster already did this */
173173
{
174174
/*
175-
* we're running a postgres backend by itself with no front end or
176-
* postmaster. Create private "shmem" and semaphores. Setting
177-
* MaxBackends = 16 is arbitrary.
175+
* We're running a postgres bootstrap process or a standalone backend.
176+
* Create private "shmem" and semaphores. Force MaxBackends to 1 so
177+
* that we don't allocate more resources than necessary.
178178
*/
179-
CreateSharedMemoryAndSemaphores(true, 16, 0);
179+
SetConfigOption("max_connections", "1",
180+
PGC_POSTMASTER, PGC_S_OVERRIDE);
181+
182+
CreateSharedMemoryAndSemaphores(true, MaxBackends, 0);
180183
}
181184
}
182185

0 commit comments

Comments
 (0)