While hacking today, I realized that a couple of comments related to
InitializeMaxBackends are obsolete.  Originally, the number of
background workers was determined just after processing
shared_preload_libraries, but I changed that in commit
6bc8ef0b7f1f1df3998745a66e1790e27424aa0c with the introduction of
max_worker_processes.  The attached patch fixes up the comments so
that they no longer offer up an obsolete rationale for what the code
does.  Assuming nobody minds, I plan to commit this, and, since the
comments are actually wrong and might confuse someone, back-patch this
change as far as 9.4, where the above-mentioned commit first appeared.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c
index 000524d..0c8bc8f 100644
--- a/src/backend/postmaster/postmaster.c
+++ b/src/backend/postmaster/postmaster.c
@@ -923,8 +923,9 @@ PostmasterMain(int argc, char *argv[])
 	process_shared_preload_libraries();
 
 	/*
-	 * Now that loadable modules have had their chance to register background
-	 * workers, calculate MaxBackends.
+	 * Calculate the maximum possible number of backends.  This must happen
+	 * after we have finished initalizing GUCs and before shared memory size
+	 * is determined.
 	 */
 	InitializeMaxBackends();
 
diff --git a/src/backend/utils/init/postinit.c b/src/backend/utils/init/postinit.c
index 7b19714..c99e7c0 100644
--- a/src/backend/utils/init/postinit.c
+++ b/src/backend/utils/init/postinit.c
@@ -482,9 +482,8 @@ pg_split_opts(char **argv, int *argcp, const char *optstr)
 /*
  * Initialize MaxBackends value from config options.
  *
- * This must be called after modules have had the chance to register background
- * workers in shared_preload_libraries, and before shared memory size is
- * determined.
+ * This must happen after we finish setting the initial values for GUCs,
+ * and before shared memory size is determined.
  *
  * Note that in EXEC_BACKEND environment, the value is passed down from
  * postmaster to subprocesses via BackendParameters in SubPostmasterMain; only
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to