1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-07 19:06:32 +03:00

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
This commit is contained in:
Robert Haas
2022-04-12 14:45:23 -04:00
parent 2c9381840f
commit 7fc0e7de9f
19 changed files with 142 additions and 227 deletions

View File

@@ -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;