Re: Improve logging when using Huge Pages - Mailing list pgsql-hackers

From Nathan Bossart
Subject Re: Improve logging when using Huge Pages
Date
Msg-id 20230308221656.GA3621885@nathanxps13
Whole thread Raw
In response to Re: Improve logging when using Huge Pages  (Nathan Bossart <nathandbossart@gmail.com>)
Responses Re: Improve logging when using Huge Pages  (Stephen Frost <sfrost@snowman.net>)
List pgsql-hackers
On Wed, Feb 15, 2023 at 10:13:17AM -0800, Nathan Bossart wrote:
> On Tue, Feb 14, 2023 at 07:32:56PM -0600, Justin Pryzby wrote:
>> On Mon, Feb 13, 2023 at 08:18:52PM -0800, Nathan Bossart wrote:
>>> I'm curious why you chose to make this a string instead of an enum.  There
>>> might be little practical difference, but since there are only three
>>> possible values, I wonder if it'd be better form to make it an enum.
>> 
>> It takes more code to write as an enum - see 002.txt.  I'm not convinced
>> this is better.
>> 
>> But your comment made me fix its <type>, and reconsider the strings,
>> which I changed to active={unknown/true/false} rather than {unk/on/off}.
>> It could also be active={unknown/yes/no}...
> 
> I think unknown/true/false is fine.  I'm okay with using a string if no one
> else thinks it should be an enum (or a bool).

There's been no response for this, so I guess we can proceed with a string
GUC.

+        Reports whether huge pages are in use by the current instance.
+        See <xref linkend="guc-huge-pages"/> for more information.

I still think we should say "server" in place of "current instance" here.

+        {"huge_pages_active", PGC_INTERNAL, PRESET_OPTIONS,
+            gettext_noop("Indicates whether huge pages are in use."),
+            NULL,
+            GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE | GUC_RUNTIME_COMPUTED
+        },

I don't think we need to use GUC_RUNTIME_COMPUTED.  'postgres -C' seems to
always report "unknown" for this GUC, so all this would do is cause that
command to error unnecessarily when the server is running.

It might be worth documenting exactly what "unknown" means.  IIUC you'll
only ever see "on" or "off" via SHOW or pg_settings, which doesn't seem
tremendously obvious.

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



pgsql-hackers by date:

Previous
From: "Anton A. Melnikov"
Date:
Subject: Re: odd buildfarm failure - "pg_ctl: control file appears to be corrupt"
Next
From: Andrew Dunstan
Date:
Subject: Re: buildfarm + meson