Skip to content

Commit 701d918

Browse files
committed
Fix misleading comments about background worker registration.
Since 6bc8ef0, the maximum number of backends can't change as background workers are registered, but these comments still reflect the way things worked prior to that. Also, per recent discussion, some modules call SetConfigOption() from _PG_init(). It's not entirely clear to me whether we want to regard that as a fully supported operation, but since we know it's a thing that happens, it at least deserves a mention in the comments, so add that. Nathan Bossart, reviewed by Anton A. Melnikov Discussion: http://postgr.es/m/20220419154658.GA2487941@nathanxps13
1 parent ee97d46 commit 701d918

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
@@ -1005,10 +1005,8 @@ PostmasterMain(int argc, char *argv[])
10051005
LocalProcessControlFile(false);
10061006

10071007
/*
1008-
* Register the apply launcher. Since it registers a background worker,
1009-
* it needs to be called before InitializeMaxBackends(), and it's probably
1010-
* a good idea to call it before any modules had chance to take the
1011-
* background worker slots.
1008+
* Register the apply launcher. It's probably a good idea to call this
1009+
* before any modules had a chance to take the background worker slots.
10121010
*/
10131011
ApplyLauncherRegister();
10141012

@@ -1029,8 +1027,8 @@ PostmasterMain(int argc, char *argv[])
10291027
#endif
10301028

10311029
/*
1032-
* Now that loadable modules have had their chance to register background
1033-
* workers, calculate MaxBackends.
1030+
* Now that loadable modules have had their chance to alter any GUCs,
1031+
* calculate MaxBackends.
10341032
*/
10351033
InitializeMaxBackends();
10361034

src/backend/utils/init/postinit.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -538,9 +538,8 @@ pg_split_opts(char **argv, int *argcp, const char *optstr)
538538
/*
539539
* Initialize MaxBackends value from config options.
540540
*
541-
* This must be called after modules have had the chance to register background
542-
* workers in shared_preload_libraries, and before shared memory size is
543-
* determined.
541+
* This must be called after modules have had the chance to alter GUCs in
542+
* shared_preload_libraries and before shared memory size is determined.
544543
*
545544
* Note that in EXEC_BACKEND environment, the value is passed down from
546545
* postmaster to subprocesses via BackendParameters in SubPostmasterMain; only

0 commit comments

Comments
 (0)