Heikki Linnakangas wrote: > Might be cleaner to directly assign the correct value to MaxBackends > above, ie. "MaxBackends = MaxConnections + newval + 1 + > GetNumShmemAttachedBgworkers()". With a comment to remind that it > needs to be kept in sync with the other places where that > calculation is done, in guc.c. Or put that calculation in a new > function and call it above and in guc.c. > > Thinking about this some more, it might be cleaner to move the > responsibility of setting MaxBackends out of guc.c, into > postmaster.c. The guc machinery would set max_connections and > autovacuum_max_workers as usual, but not try to set MaxBackends. > After reading the config file in postmaster.c, calculate > MaxBackends.
Here's a small patch that applies on top of yours. Do you intend to commit this? If not, let me know and I'll do it. Thanks. -- Álvaro Herrera http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services
diff --git a/src/backend/utils/init/globals.c b/src/backend/utils/init/globals.c index 8dd2b4b..0d808d0 100644 --- a/src/backend/utils/init/globals.c +++ b/src/backend/utils/init/globals.c @@ -103,13 +103,14 @@ int work_mem = 1024; int maintenance_work_mem = 16384; /* - * Primary determinants of sizes of shared-memory structures. MaxBackends is - * MaxConnections + autovacuum_max_workers + 1 (it is computed by the GUC - * assign hooks for those variables): + * Primary determinants of sizes of shared-memory structures. + * + * MaxBackends is computed by PostmasterMain after modules have had a chance to + * register background workers. */ int NBuffers = 1000; -int MaxBackends = 100; int MaxConnections = 90; +int MaxBackends = 0; int VacuumCostPageHit = 1; /* GUC parameters for vacuum */ int VacuumCostPageMiss = 10;
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers