1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-16 15:02:33 +03:00

Allow maximum number of backends to be set at configure time

(--with-maxbackends).  Add a postmaster switch (-N backends) that allows
the limit to be reduced at postmaster start time.  (You can't increase it,
sorry to say, because there are still some fixed-size arrays.)
Grab the number of semaphores indicated by min(MAXBACKENDS, -N) at
postmaster startup, so that this particular form of bogus configuration
is exposed immediately rather than under heavy load.
This commit is contained in:
Tom Lane
1999-02-19 06:06:39 +00:00
parent 612b8434e4
commit e77b630cf0
14 changed files with 502 additions and 392 deletions

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/sinvaladt.c,v 1.16 1999/02/13 23:18:16 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/sinvaladt.c,v 1.17 1999/02/19 06:06:03 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -119,7 +119,7 @@ SIAssignBackendId(SISeg *segInOutP, BackendTag backendTag)
stateP = NULL;
for (index = 0; index < MaxBackendId; index += 1)
for (index = 0; index < MAXBACKENDS; index++)
{
if (segInOutP->procState[index].tag == InvalidBackendTag ||
segInOutP->procState[index].tag == backendTag)
@@ -141,7 +141,7 @@ SIAssignBackendId(SISeg *segInOutP, BackendTag backendTag)
/* verify that all "procState" entries checked for matching tags */
for (index += 1; index < MaxBackendId; index += 1)
for (index++; index < MAXBACKENDS; index++)
{
if (segInOutP->procState[index].tag == backendTag)
{
@@ -565,7 +565,7 @@ SIDecProcLimit(SISeg *segP, int num)
{
int i;
for (i = 0; i < MaxBackendId; i++)
for (i = 0; i < MAXBACKENDS; i++)
{
/* decrement only, if there is a limit > 0 */
if (segP->procState[i].limit > 0)
@@ -622,7 +622,7 @@ SISetProcStateInvalid(SISeg *segP)
{
int i;
for (i = 0; i < MaxBackendId; i++)
for (i = 0; i < MAXBACKENDS; i++)
{
if (segP->procState[i].limit == 0)
{
@@ -696,7 +696,7 @@ SIDelExpiredDataEntries(SISeg *segP)
h;
min = 9999999;
for (i = 0; i < MaxBackendId; i++)
for (i = 0; i < MAXBACKENDS; i++)
{
h = SIGetProcStateLimit(segP, i);
if (h >= 0)
@@ -740,7 +740,7 @@ SISegInit(SISeg *segP)
SISetEndEntryChain(segP, InvalidOffset);
SISetNumEntries(segP, 0);
SISetMaxNumEntries(segP, MAXNUMMESSAGES);
for (i = 0; i < MaxBackendId; i++)
for (i = 0; i < MAXBACKENDS; i++)
{
segP->procState[i].limit = -1; /* no backend active !! */
segP->procState[i].resetState = false;