Re: Estimating HugePages Requirements? - Mailing list pgsql-hackers

From Nathan Bossart
Subject Re: Estimating HugePages Requirements?
Date
Msg-id 20220324203108.GB1855897@nathanxps13
Whole thread Raw
In response to Re: Estimating HugePages Requirements?  (Magnus Hagander <magnus@hagander.net>)
Responses Re: Estimating HugePages Requirements?
List pgsql-hackers
On Thu, Mar 24, 2022 at 02:07:26PM +0100, Magnus Hagander wrote:
> On Wed, Mar 23, 2022 at 7:25 AM Michael Paquier <michael@paquier.xyz> wrote:
>> On Tue, Mar 15, 2022 at 03:44:39PM -0700, Nathan Bossart wrote:
>> > A simple approach could be to just set log_min_messages to PANIC before
>> > exiting.  I've attached a patch for this.  With this patch, we'll still see
>> > a FATAL if we try to use 'postgres -C' for a runtime-computed GUC on a
>> > running server, and there will be no extra output as long as the user sets
>> > log_min_messages to INFO or higher (i.e., not a DEBUG* value).  For
>> > comparison, 'postgres -C' for a non-runtime-computed GUC does not emit
>> > extra output as long as the user sets log_min_messages to DEBUG2 or higher.
>>
>> >               puts(config_val ? config_val : "");
>> > +
>> > +             /* don't emit shutdown messages */
>> > +             SetConfigOption("log_min_messages", "PANIC", PGC_INTERNAL, PGC_S_OVERRIDE);
>> > +
>> >               ExitPostmaster(0);
>>
>> That's fancy, but I don't like that much.  And this would not protect
>> either against any messages generated before this code path, either,
> 
> But neither would the suggestion of redirecting stderr to /dev/null.
> In fact, doing the redirect it will *also* throw away any FATAL that
> happens. In fact, using the 2>/dev/null method, we *also* remove the
> message that says there's another postmaster running in this
> directory, which is strictly worse than the override of
> log_min_messages.
> 
> That said, the redirect can be removed without recompiling postgres,
> so it is probably still hte better choice as a temporary workaround.
> But we should really look into getting a better solution in place once
> we start on 16.

A couple of other options to consider:

1) Always set log_min_messages to WARNING/ERROR/FATAL for 'postgres -C'.
We might need some special logic for handling the case where the user is
inspecting the log_min_messages parameter.  With this approach, you'd
probably never get extra output unless something was wrong (e.g., database
already running when inspecting a runtime-computed GUC).  Also, this would
silence any extra output that you might see today with non-runtime-computed
GUCs.

2) Add some way to skip just the shutdown message (e.g., a variable set
when output_config_variable is true).  With this approach, you wouldn't get
extra output by default, but you still might if log_min_messages is set to
something like DEBUG3.  This wouldn't impact any extra output that you see
today with non-runtime-computed GUCs.

-- 
Nathan Bossart
Amazon Web Services: https://aws.amazon.com



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: make MaxBackends available in _PG_init
Next
From: Tom Lane
Date:
Subject: Re: [PATCH] pg_statio_all_tables: several rows per table due to invalid TOAST index