aboutsummaryrefslogtreecommitdiff
path: root/src/backend/storage/lmgr/proc.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>1999-02-21 01:41:55 +0000
committerTom Lane <tgl@sss.pgh.pa.us>1999-02-21 01:41:55 +0000
commit9d197856dd5eda5cf85b15e564ae09ef8fef0e9e (patch)
treeac85492fb01823aeb836e54f5e5511366346f418 /src/backend/storage/lmgr/proc.c
parent75cccd0ad3184e3fa283f407c765520d3c774c86 (diff)
downloadpostgresql-9d197856dd5eda5cf85b15e564ae09ef8fef0e9e.tar.gz
postgresql-9d197856dd5eda5cf85b15e564ae09ef8fef0e9e.zip
Rearrange handling of MAXBACKENDS a little bit. The default setting
of MAXBACKENDS is now 1024, since all it's costing is about 32 bytes of memory per array slot. configure's --with-maxbackends switch now controls DEF_MAXBACKENDS which is simply the default value of the postmaster's -N switch. Thus, the out-of-the-box configuration will still limit you to 64 backends, but you can go up to 1024 backends simply by restarting the postmaster with a different -N switch --- no rebuild required.
Diffstat (limited to 'src/backend/storage/lmgr/proc.c')
-rw-r--r--src/backend/storage/lmgr/proc.c41
1 files changed, 23 insertions, 18 deletions
diff --git a/src/backend/storage/lmgr/proc.c b/src/backend/storage/lmgr/proc.c
index 7452270fdf4..2bb66c09d6a 100644
--- a/src/backend/storage/lmgr/proc.c
+++ b/src/backend/storage/lmgr/proc.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.50 1999/02/19 07:10:48 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.51 1999/02/21 01:41:45 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -46,7 +46,7 @@
* This is so that we can support more backends. (system-wide semaphore
* sets run out pretty fast.) -ay 4/95
*
- * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.50 1999/02/19 07:10:48 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.51 1999/02/21 01:41:45 tgl Exp $
*/
#include <sys/time.h>
#include <unistd.h>
@@ -154,23 +154,28 @@ InitProcGlobal(IPCKey key, int maxBackends)
*/
on_shmem_exit(ProcFreeAllSemaphores, NULL);
- /* Pre-create the semaphores for the first maxBackends processes */
- for (i = 0;
- i < (maxBackends+PROC_NSEMS_PER_SET-1) / PROC_NSEMS_PER_SET;
- i++)
+ /* Pre-create the semaphores for the first maxBackends processes,
+ * unless we are running as a standalone backend.
+ */
+ if (key != PrivateIPCKey)
{
- IPCKey semKey = ProcGlobal->currKey + i;
- int semId;
- int semstat;
-
- semId = IpcSemaphoreCreate(semKey,
- PROC_NSEMS_PER_SET,
- IPCProtection,
- IpcSemaphoreDefaultStartValue,
- 0,
- &semstat);
- /* mark this sema set allocated */
- ProcGlobal->freeSemMap[i] = (1 << PROC_NSEMS_PER_SET);
+ for (i = 0;
+ i < (maxBackends+PROC_NSEMS_PER_SET-1) / PROC_NSEMS_PER_SET;
+ i++)
+ {
+ IPCKey semKey = ProcGlobal->currKey + i;
+ int semId;
+ int semstat;
+
+ semId = IpcSemaphoreCreate(semKey,
+ PROC_NSEMS_PER_SET,
+ IPCProtection,
+ IpcSemaphoreDefaultStartValue,
+ 0,
+ &semstat);
+ /* mark this sema set allocated */
+ ProcGlobal->freeSemMap[i] = (1 << PROC_NSEMS_PER_SET);
+ }
}
}
}