Re: make MaxBackends available in _PG_init
Robert Haas <robertmhaas@gmail.com>
From: Robert Haas <robertmhaas@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Nathan Bossart <nathandbossart@gmail.com>,
Andres Freund <andres@anarazel.de>, Julien Rouhaud <rjuju123@gmail.com>, Michael Paquier <michael@paquier.xyz>, "Bossart, Nathan" <bossartn@amazon.com>,
Fujii Masao <masao.fujii@oss.nttdata.com>, "wangsh.fnst@fujitsu.com" <wangsh.fnst@fujitsu.com>, Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>, Greg Sabino Mullane <htamfids@gmail.com>, "pgsql-hackers@lists.postgresql.org" <pgsql-hackers@lists.postgresql.org>
Date: 2022-04-13T15:50:30Z
Lists: pgsql-hackers
On Wed, Apr 13, 2022 at 11:39 AM Tom Lane <tgl@sss.pgh.pa.us> wrote: > Is there anything else typically done in _PG_init that has to be > conditional on process_shared_preload_libraries_in_progress? I recall > something about reserving LWLocks, which probably should get the same > treatment. If we can get to a point where _PG_init shouldn't need to > care about process_shared_preload_libraries_in_progress, because all > the stuff that would care is moved to this new hook, then that would > be very clear cleanup. What's a little wonky right now is that it's fairly common for extensions to just return straight-off without doing *anything at all* if !process_shared_preload_libraries_in_progress. See pg_stat_statements for example. It seems kind of strange to me to make registering GUCs dependent on process_shared_preload_libraries_in_progress; why shouldn't that just happen always? It's understandable that we don't want to install the hook functions if we're not being loaded from shared_preload_libaries, though. It may be too much to hope that we're going to completely get rid of process_shared_preload_libraries_in_progress tests. But even given that, I think having a request-shared-mem hook makes sense and would make things cleaner than they are today. Maybe in the future we'll end up with other hooks as well, like a "this is the place to register GUCs" hook and a perhaps a "this is the place to register you custom rmgr" hook. I'm not really sure that we need those and I don't want to make things complicated just for the heck of it, but it's not shocking that different operations need to happen at different times in the startup sequence, and I don't think we should be afraid to split up the monolithic _PG_init() into as many separate things as are required to make it work right. -- Robert Haas EDB: http://www.enterprisedb.com
Commits
-
Add a new shmem_request_hook hook.
- 4f2400cb3f10 15.0 landed
-
Remove non-functional code for unloading loadable modules.
- ab02d702ef08 15.0 landed
-
Fix misleading comments about background worker registration.
- 701d918a426b 15.0 landed
-
Revert the addition of GetMaxBackends() and related stuff.
- 7fc0e7de9fb8 15.0 landed
-
Fix typo in multixact.c
- 0147fc7c8c92 15.0 landed
-
Reduce more the number of calls to GetMaxBackends()
- 4567596316d1 15.0 landed
-
Remove MaxBackends variable in favor of GetMaxBackends() function.
- aa64f23b0292 15.0 landed
-
Fix comments about bgworker registration before MaxBackends initialization
- 5ecd0183fb6a 15.0 landed
-
Fix bogus assertion in BootstrapModeMain().
- e12694523e7e 15.0 cited
-
Make sure MaxBackends is always set
- dfbba2c86cc8 9.3.0 cited