1
0
mirror of https://github.com/postgres/postgres.git synced 2025-10-25 13:17:41 +03:00

Code review for superuser_reserved_connections patch. Don't try to do

database access outside a transaction; revert bogus performance improvement
in SIBackendInit(); improve comments; add documentation (this part courtesy
Neil Conway).
This commit is contained in:
Tom Lane
2002-11-21 06:36:08 +00:00
parent 02d83d7565
commit 8362be35e8
5 changed files with 90 additions and 63 deletions

View File

@@ -37,7 +37,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.298 2002/11/18 00:40:46 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.299 2002/11/21 06:36:08 tgl Exp $
*
* NOTES
*
@@ -154,12 +154,11 @@ int MaxBackends = DEF_MAXBACKENDS;
/*
* ReservedBackends is the number of backends reserved for superuser use.
* This number is taken out of the pool size given by MaxBackends so
* number of backend slots available to none super users is
* (MaxBackends - ReservedBackends). Note, existing super user
* connections are not taken into account once this lower limit has
* been reached, i.e. superuser connections made before the lower limit
* is reached always count towards that limit and are not taken from
* ReservedBackends.
* number of backend slots available to non-superusers is
* (MaxBackends - ReservedBackends). Note what this really means is
* "if there are <= ReservedBackends connections available, only superusers
* can make new connections" --- pre-existing superuser connections don't
* count against the limit.
*/
int ReservedBackends = 2;
@@ -568,7 +567,15 @@ PostmasterMain(int argc, char *argv[])
}
/*
* Check for invalid combinations of switches
* Now we can set the data directory, and then read postgresql.conf.
*/
checkDataDir(potential_DataDir); /* issues error messages */
SetDataDir(potential_DataDir);
ProcessConfigFile(PGC_POSTMASTER);
/*
* Check for invalid combinations of GUC settings.
*/
if (NBuffers < 2 * MaxBackends || NBuffers < 16)
{
@@ -581,16 +588,11 @@ PostmasterMain(int argc, char *argv[])
ExitPostmaster(1);
}
checkDataDir(potential_DataDir); /* issues error messages */
SetDataDir(potential_DataDir);
ProcessConfigFile(PGC_POSTMASTER);
/*
* Force an exit if ReservedBackends is not less than MaxBackends.
*/
if (ReservedBackends >= MaxBackends)
elog(FATAL, "superuser_reserved_connections must be less than max_connections.");
{
postmaster_error("superuser_reserved_connections must be less than max_connections.");
ExitPostmaster(1);
}
/*
* Now that we are done processing the postmaster arguments, reset