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 1100207.1649864342@sss.pgh.pa.us
Whole thread Raw
In response to Re: make MaxBackends available in _PG_init  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: make MaxBackends available in _PG_init
List pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes:
> I guess my feeling about this is that _PG_init() is sort of a grab
> bag, and that's not very good. You're supposed to register new GUCs
> there, and request shared memory space, and install any hook functions
> you want to use, and maybe some other stuff. But why is it appropriate
> for all of those things to happen at the same time? I think it pretty
> clearly isn't, and that's why you see _PG_init() functions testing
> process_shared_preload_libraries_in_progress, and why
> RequestAddinShmemSpace() is a no-op if it's not the right time for
> such things. To me, all of that is just a sign that the system is
> badly designed.

Hmm, that's a good point.  If we can replace "RequestAddinShmemSpace
does nothing if called at the wrong time" with "RequestAddinShmemSpace
throws error if called at the wrong time", that seems like a pretty
clear improvement in robustness.

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.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Atomic rename feature for Windows.
Next
From: Robert Haas
Date:
Subject: Re: Improving the "Routine Vacuuming" docs