Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8f19603

Browse files
committed
Add startup-time check that -B is not unreasonably small for
given number of backends (-N), per recent discussion in pghackers list.
1 parent4cd4a54 commit8f19603

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

‎src/backend/postmaster/postmaster.c

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
*
1212
* IDENTIFICATION
13-
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.105 1999/05/25 16:10:40 momjian Exp $
13+
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.106 1999/06/04 21:14:46 tgl Exp $
1414
*
1515
* NOTES
1616
*
@@ -427,7 +427,7 @@ PostmasterMain(int argc, char *argv[])
427427
* means we have to start each backend with a -B # to make
428428
* sure they know how many buffers were allocated.
429429
*/
430-
NBuffers=atol(optarg);
430+
NBuffers=atoi(optarg);
431431
strcat(ExtraOptions," -B ");
432432
strcat(ExtraOptions,optarg);
433433
break;
@@ -530,9 +530,26 @@ PostmasterMain(int argc, char *argv[])
530530
break;
531531
}
532532
}
533+
534+
/*
535+
* Select default values for switches where needed
536+
*/
533537
if (PostPortName==-1)
534538
PostPortName=pq_getport();
535539

540+
/*
541+
* Check for invalid combinations of switches
542+
*/
543+
if (NBuffers<2*MaxBackends||NBuffers<16)
544+
{
545+
/* Do not accept -B so small that backends are likely to starve for
546+
* lack of buffers. The specific choices here are somewhat arbitrary.
547+
*/
548+
fprintf(stderr,"%s: -B must be at least twice -N and at least 16.\n",
549+
progname);
550+
exit(1);
551+
}
552+
536553
checkDataDir(DataDir,&DataDirOK);/* issues error messages */
537554
if (!DataDirOK)
538555
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp