Re: make MaxBackends available in _PG_init - Mailing list pgsql-hackers

From Tom Lane
Subject Re: make MaxBackends available in _PG_init
Date
Msg-id 2470289.1650327424@sss.pgh.pa.us
Whole thread Raw
In response to Re: make MaxBackends available in _PG_init  (Nathan Bossart <nathandbossart@gmail.com>)
Responses Re: make MaxBackends available in _PG_init  (Julien Rouhaud <rjuju123@gmail.com>)
List 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



pgsql-hackers by date:

Previous
From: Kyotaro Horiguchi
Date:
Subject: Re: TRAP: FailedAssertion("tabstat->trans == trans", File: "pgstat_relation.c", Line: 508
Next
From: Peter Geoghegan
Date:
Subject: Re: Why does pg_class.reltuples count only live tuples in indexes (after VACUUM runs)?