]> granicus.if.org Git - postgresql/commitdiff
Fix IsUnderPostmaster/EXEC_BACKEND confusion
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Wed, 2 Jan 2013 21:39:20 +0000 (18:39 -0300)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Wed, 2 Jan 2013 21:39:20 +0000 (18:39 -0300)
src/backend/bootstrap/bootstrap.c
src/backend/tcop/postgres.c
src/backend/utils/init/postinit.c

index 7787c1199b116fabfde9e36d7b174eb5687969bc..82ef726574e7f62b8a5247f79a31c84074c96c10 100644 (file)
@@ -359,6 +359,10 @@ AuxiliaryProcessMain(int argc, char *argv[])
        SetProcessingMode(BootstrapProcessing);
        IgnoreSystemIndexes = true;
 
+       /* Initialize MaxBackends (if under postmaster, was done already) */
+       if (!IsUnderPostmaster)
+               InitializeMaxBackends();
+
        BaseInit();
 
        /*
index 937191334fc558ffaff225bda242a9b323e8683a..407c548cf8f07b7f217f88134de57ebf8a1adb00 100644 (file)
@@ -3654,10 +3654,8 @@ PostgresMain(int argc, char *argv[], const char *username)
                 */
                CreateDataDirLockFile(false);
 
-               /* In EXEC_BACKEND, this was set via BackendParameters */
-#ifndef EXEC_BACKEND
+               /* Initialize MaxBackends (if under postmaster, was done already) */
                InitializeMaxBackends();
-#endif
        }
 
        /* Early initialization */
index ddd79d0aa2dfb24ba7cb2f00c1b83fc6c4c5de69..7e21ceae8801f49b6a1cf10f0800362accb346b0 100644 (file)
@@ -427,6 +427,11 @@ pg_split_opts(char **argv, int *argcp, char *optstr)
  * 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.
+ *
+ * Note that in EXEC_BACKEND environment, the value is passed down from
+ * postmaster to subprocesses via BackendParameters in SubPostmasterMain; only
+ * postmaster itself and processes not under postmaster control should call
+ * this.
  */
 void
 InitializeMaxBackends(void)