Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1paJIG-0000Ga-68 for pgsql-hackers@arkaria.postgresql.org; Thu, 09 Mar 2023 16:39:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1paJID-00031u-Ql for pgsql-hackers@arkaria.postgresql.org; Thu, 09 Mar 2023 16:39:01 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1paJID-00031Z-HD for pgsql-hackers@lists.postgresql.org; Thu, 09 Mar 2023 16:39:01 +0000 Received: from mail-il1-x12d.google.com ([2607:f8b0:4864:20::12d]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1paJIB-0007S1-4n for pgsql-hackers@postgresql.org; Thu, 09 Mar 2023 16:39:00 +0000 Received: by mail-il1-x12d.google.com with SMTP id p13so1308880ilp.11 for ; Thu, 09 Mar 2023 08:38:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20210112.gappssmtp.com; s=20210112; t=1678379938; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=QrZgiChn5nSv93kKN3nWrqjeE/NbL6jxis1PYvqbJSA=; b=LAbemeXzY5kkXFK7Nz3AjXckqopVnHKJ0Lx6ru7Rwnonm0qvlBzQvnC9b/mjyhRD4M l4R+Xo3riGfOQRBfJqnqYWpYst2jyg+4H4bIbZQYDp8LDYasLqBMwNwvxT+0kvWo1azW gEDuZDJCL3ekaQPyv1xMdFS4T8yN5rQUOdYodSy9IxwDFj6f//B1Qkt7Vp6ygfgoXK6l i7Wg+3RHXDSbmL8rfX69amHTBHlcBt8aTizjY4xomrWVLYKqZZodk3VSZp5zgKwawp5o a9GNits7lzj6QPUxzcqWYp1si6UuCthWdPks2JwUmyooIwnYShGkwkQjcjRclGTBf6/B CgqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678379938; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=QrZgiChn5nSv93kKN3nWrqjeE/NbL6jxis1PYvqbJSA=; b=eQI/fRvi/aewo/+4Z0MPtKhFx0l+LozzAgDwHY4OUYI7kkHkN7jH37PkJDEKeoPrP4 uwy/ELPV6DyGgMNcXAOQe3r5GISQxGGwIaXl9JY8aybJQ4JIvHxtBMZFJWpRZdOs+AI9 DyvnGXFBEQ5QLEn3c42E3ss6ilvTmE3xl894lns5bwUTVuCgxPsgr2dvJqRNr8IKmRQB admfk08ytw0rv9AX1fAKny/pcSRYob1q37m54B5vjBEDnJK8KZKK8Z5Vqq3B7CBqilwj t7vqH2jAOKt9QUuwWR2uy3abLd5zERF1DBK09KScEex73pt63fIElJcweGQIjeUU20aX Nsjw== X-Gm-Message-State: AO0yUKV5ibahNJW/C75G+luUrTLUg/sL3WDiU7/9pvCCGz67OOwGpsLo gTQgH+T2F5IO17fuZyrDB/v4Fw== X-Google-Smtp-Source: AK7set+2gXe+Z48FF99kPm7Urp9NHu05vBWWPEJ8uimQBExWhO4yHevDE27SO4TlfnlWOszECDOIQQ== X-Received: by 2002:a05:6e02:1c23:b0:316:e793:9dba with SMTP id m3-20020a056e021c2300b00316e7939dbamr4526529ilh.26.1678379938179; Thu, 09 Mar 2023 08:38:58 -0800 (PST) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id s3-20020a02c503000000b003a0565a5750sm5727188jam.119.2023.03.09.08.38.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Mar 2023 08:38:57 -0800 (PST) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 81A1C801309; Thu, 9 Mar 2023 10:38:56 -0600 (CST) Date: Thu, 9 Mar 2023 10:38:56 -0600 From: Justin Pryzby To: Stephen Frost Cc: Nathan Bossart , Alvaro Herrera , Andres Freund , Michael Paquier , Kyotaro Horiguchi , thomas.munro@gmail.com, tgl@sss.pgh.pa.us, john.naylor@enterprisedb.com, noriyoshi.shinoda@hpe.com, jchampion@timescale.com, sawada.mshk@gmail.com, masao.fujii@oss.nttdata.com, pgsql-hackers@postgresql.org, rjuju123@gmail.com Subject: Re: Improve logging when using Huge Pages Message-ID: References: <20230208231803.GP1653@telsasoft.com> <20230209094013.67varf63bihops33@alvherre.pgsql> <20230209192909.GA606606@nathanxps13> <20230213232245.GI1653@telsasoft.com> <20230214041852.GA1190218@nathanxps13> <20230215013256.GP1653@telsasoft.com> <20230215181317.GA1353037@nathanxps13> <20230308221656.GA3621885@nathanxps13> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, Mar 09, 2023 at 09:34:10AM -0500, Stephen Frost wrote: > Greetings, > > * Nathan Bossart (nathandbossart@gmail.com) wrote: > > 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 , 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. > > Just happened to see this and I'm not really a fan of this being a > string when it's pretty clear that's not what it actually is. I don't understand what you mean by that. Why do you say it isn't a string ? > > + Reports whether huge pages are in use by the current instance. > > + See for more information. > > > > I still think we should say "server" in place of "current instance" here. > > We certainly use 'server' a lot more in config.sgml than we do > 'instance'. "currently running server" might be closer to how we > describe a running PG system in other parts (we talk about "currently > running server processes", "while the server is running", "When running > a standby server", "when the server is running"; "instance" is used much > less and seems to more typically refer to 'state of files on disk' in my > reading vs. 'actively running process' though there's some of each). I called it "instance" since the GUC has no meaning when it's not running. I'm fine to rename it to "running server". > > + {"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. > > ... or we could consider adjusting things to actually try the mmap() and > find out if we'd end up with huge pages or not. That seems like a bad idea, since it might work one moment and fail one moment later. If we could tell in advance whether it was going to work, we wouldn't be here, and probably also wouldn't have invented huge_pages=true. > > 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. > > If we could get rid of that case and just make this a boolean, that > seems like it'd really be the best answer. > > To that end- perhaps this isn't appropriate as a GUC at all? Why not > have this just be a system information function? Functionally it really > provides the same info- if the server is running then you get back > either true or false, if it's not then you can't call it but that's > hardly different from an unknown or error result. We talked about making it a function ~6 weeks ago. Is there an agreement to use a function, instead ? -- Justin