mirror of
https://github.com/postgres/postgres.git
synced 2025-04-22 23:02:54 +03:00
Add startup-time check that -B is not unreasonably small for
given number of backends (-N), per recent discussion in pghackers list.
This commit is contained in:
parent
4cd4a54c80
commit
8f19603d6c
@ -10,7 +10,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.105 1999/05/25 16:10:40 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.106 1999/06/04 21:14:46 tgl Exp $
|
||||||
*
|
*
|
||||||
* NOTES
|
* NOTES
|
||||||
*
|
*
|
||||||
@ -427,7 +427,7 @@ PostmasterMain(int argc, char *argv[])
|
|||||||
* means we have to start each backend with a -B # to make
|
* means we have to start each backend with a -B # to make
|
||||||
* sure they know how many buffers were allocated.
|
* sure they know how many buffers were allocated.
|
||||||
*/
|
*/
|
||||||
NBuffers = atol(optarg);
|
NBuffers = atoi(optarg);
|
||||||
strcat(ExtraOptions, " -B ");
|
strcat(ExtraOptions, " -B ");
|
||||||
strcat(ExtraOptions, optarg);
|
strcat(ExtraOptions, optarg);
|
||||||
break;
|
break;
|
||||||
@ -530,9 +530,26 @@ PostmasterMain(int argc, char *argv[])
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Select default values for switches where needed
|
||||||
|
*/
|
||||||
if (PostPortName == -1)
|
if (PostPortName == -1)
|
||||||
PostPortName = pq_getport();
|
PostPortName = pq_getport();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check for invalid combinations of switches
|
||||||
|
*/
|
||||||
|
if (NBuffers < 2 * MaxBackends || NBuffers < 16)
|
||||||
|
{
|
||||||
|
/* Do not accept -B so small that backends are likely to starve for
|
||||||
|
* lack of buffers. The specific choices here are somewhat arbitrary.
|
||||||
|
*/
|
||||||
|
fprintf(stderr, "%s: -B must be at least twice -N and at least 16.\n",
|
||||||
|
progname);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
checkDataDir(DataDir, &DataDirOK); /* issues error messages */
|
checkDataDir(DataDir, &DataDirOK); /* issues error messages */
|
||||||
if (!DataDirOK)
|
if (!DataDirOK)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user