Re: make MaxBackends available in _PG_init
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Nathan Bossart <nathandbossart@gmail.com>
Cc: Robert Haas <robertmhaas@gmail.com>, Julien Rouhaud <rjuju123@gmail.com>,
Andres Freund <andres@anarazel.de>,
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-19T00:17:04Z
Lists: pgsql-hackers
Nathan Bossart <nathandbossart@gmail.com> writes: > I'm looking for a clean way to ERROR if someone attempts to call > RequestAddinShmemSpace() or RequestNamedLWLockTranche() outside of the > hook. Currently, we are using static variables in ipci.c and lwlock.c to > silently ignore invalid requests. I could add a new 'extern bool' called > 'process_shmem_requests_in_progress', but extensions could easily hack > around that to allow requests in _PG_init(). Maybe I am overthinking all > this and that is good enough. If they do that and it breaks something, that's their fault not ours. (It's not like there's not $BIGNUM ways for a C-language module to break the backend, anyway.) BTW, I'd make such errors FATAL, as it's unlikely that we can recover cleanly from an error during initialization of a loadable module. The module's likely to be only partially initialized/hooked in. regards, tom lane
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