Skip to content

Commit 5ecd018

Browse files
committed
Fix comments about bgworker registration before MaxBackends initialization
Since 6bc8ef0, InitializeMaxBackends() has used max_worker_processes instead of adapting MaxBackends to the number of background workers registered by modules loaded in shared_preload_libraries (at this time, bgworkers were only static, but gained dynamic capabilities as a matter of supporting parallel queries meaning that a control cap was necessary). Some comments referred to the past registration logic, making them confusing and incorrect, so fix these. Some of the out-of-core modules that could be loaded in this path sometimes like to manipulate dynamically some of the resource-related GUCs for their own needs, this commit adds a note about that. Author: Nathan Bossart Discussion: https://postgr.es/m/20220127181815.GA551692@nathanxps13
1 parent bf42fca commit 5ecd018

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

src/backend/postmaster/postmaster.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1014,10 +1014,8 @@ PostmasterMain(int argc, char *argv[])
10141014
LocalProcessControlFile(false);
10151015

10161016
/*
1017-
* Register the apply launcher. Since it registers a background worker,
1018-
* it needs to be called before InitializeMaxBackends(), and it's probably
1019-
* a good idea to call it before any modules had chance to take the
1020-
* background worker slots.
1017+
* Register the apply launcher. It's probably a good idea to call this
1018+
* before any modules had a chance to take the background worker slots.
10211019
*/
10221020
ApplyLauncherRegister();
10231021

@@ -1038,8 +1036,8 @@ PostmasterMain(int argc, char *argv[])
10381036
#endif
10391037

10401038
/*
1041-
* Now that loadable modules have had their chance to register background
1042-
* workers, calculate MaxBackends.
1039+
* Now that loadable modules have had their chance to alter any GUCs,
1040+
* calculate MaxBackends.
10431041
*/
10441042
InitializeMaxBackends();
10451043

src/backend/utils/init/postinit.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -483,9 +483,8 @@ pg_split_opts(char **argv, int *argcp, const char *optstr)
483483
/*
484484
* Initialize MaxBackends value from config options.
485485
*
486-
* This must be called after modules have had the chance to register background
487-
* workers in shared_preload_libraries, and before shared memory size is
488-
* determined.
486+
* This must be called after modules have had the chance to alter GUCs in
487+
* shared_preload_libraries and before shared memory size is determined.
489488
*
490489
* Note that in EXEC_BACKEND environment, the value is passed down from
491490
* postmaster to subprocesses via BackendParameters in SubPostmasterMain; only

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy