aboutsummaryrefslogtreecommitdiff
path: root/src/backend/postmaster/postmaster.c
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2022-04-12 14:45:23 -0400
committerRobert Haas <rhaas@postgresql.org>2022-04-12 14:45:23 -0400
commit7fc0e7de9fb8306e84d1c15211aba4308f694455 (patch)
treece8d0213123959bce52699e8e8d837d46758a2f6 /src/backend/postmaster/postmaster.c
parent2c9381840fe2d6d1c3179350493fe5fd3dcf90b5 (diff)
downloadpostgresql-7fc0e7de9fb8306e84d1c15211aba4308f694455.tar.gz
postgresql-7fc0e7de9fb8306e84d1c15211aba4308f694455.zip
Revert the addition of GetMaxBackends() and related stuff.
This reverts commits 0147fc7, 4567596, aa64f23, and 5ecd018. There is no longer agreement that introducing this function was the right way to address the problem. The consensus now seems to favor trying to make a correct value for MaxBackends available to mdules executing their _PG_init() functions. Nathan Bossart Discussion: http://postgr.es/m/20220323045229.i23skfscdbvrsuxa@jrouhaud
Diffstat (limited to 'src/backend/postmaster/postmaster.c')
-rw-r--r--src/backend/postmaster/postmaster.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c
index 3535e9e47d2..3dcaf8a4a5d 100644
--- a/src/backend/postmaster/postmaster.c
+++ b/src/backend/postmaster/postmaster.c
@@ -1005,8 +1005,10 @@ PostmasterMain(int argc, char *argv[])
LocalProcessControlFile(false);
/*
- * Register the apply launcher. It's probably a good idea to call this
- * before any modules had a chance to take the background worker slots.
+ * Register the apply launcher. Since it registers a background worker,
+ * it needs to be called before InitializeMaxBackends(), and it's probably
+ * a good idea to call it before any modules had chance to take the
+ * background worker slots.
*/
ApplyLauncherRegister();
@@ -1027,8 +1029,8 @@ PostmasterMain(int argc, char *argv[])
#endif
/*
- * Now that loadable modules have had their chance to alter any GUCs,
- * calculate MaxBackends.
+ * Now that loadable modules have had their chance to register background
+ * workers, calculate MaxBackends.
*/
InitializeMaxBackends();
@@ -6142,7 +6144,7 @@ save_backend_variables(BackendParameters *param, Port *port,
param->query_id_enabled = query_id_enabled;
param->max_safe_fds = max_safe_fds;
- param->MaxBackends = GetMaxBackends();
+ param->MaxBackends = MaxBackends;
#ifdef WIN32
param->PostmasterHandle = PostmasterHandle;
@@ -6375,7 +6377,7 @@ restore_backend_variables(BackendParameters *param, Port *port)
query_id_enabled = param->query_id_enabled;
max_safe_fds = param->max_safe_fds;
- SetMaxBackends(param->MaxBackends);
+ MaxBackends = param->MaxBackends;
#ifdef WIN32
PostmasterHandle = param->PostmasterHandle;