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 1pbwnu-0001P8-K9 for pgsql-hackers@arkaria.postgresql.org; Tue, 14 Mar 2023 05:02:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pbwnt-0006y8-3Y for pgsql-hackers@arkaria.postgresql.org; Tue, 14 Mar 2023 05:02:29 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pbwns-0006xz-QC for pgsql-hackers@lists.postgresql.org; Tue, 14 Mar 2023 05:02:28 +0000 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pbwnq-0007tr-C3 for pgsql-hackers@postgresql.org; Tue, 14 Mar 2023 05:02:28 +0000 Received: by mail-pl1-x635.google.com with SMTP id i3so15361631plg.6 for ; Mon, 13 Mar 2023 22:02:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678770144; h=content-transfer-encoding:mime-version:user-agent:references :in-reply-to:from:subject:cc:to:message-id:date:from:to:cc:subject :date:message-id:reply-to; bh=ViFUV5sqLBxrPPJF6pEvV99Evt7onqEm88kERE+0dKw=; b=O0YXD/3FuflSvVReWRykccUWQQVv4b2W9WUSor1kuW5QtsYv87y39iJvig6jDIyKlL 47RsVha8LupKBYQvqq6Ud1Y7WrqfTw+mwNeA/jAK/eB6e1piTZASIPhLiXyNHfVtATyB M8qWLSeIeqO16jUGVDMjksqcB56tD1vB1uKzEzDzhFfUvz7UQUUDtND5HOgwM3QtC5CY 2pyXeByJY4GKxIR4bSD1/3Sdh5BjY7YzA8jTrQH2p659XoL6bySDT7KZFpIPn/SOmkJ8 xIzC21em5QBOapAU7NkZf3jsXliK2mnxi6nT/LpAUL7bzNg5jSSUkQXdtHqN/H7OJP+R CTtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678770144; h=content-transfer-encoding:mime-version:user-agent:references :in-reply-to:from:subject:cc:to:message-id:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=ViFUV5sqLBxrPPJF6pEvV99Evt7onqEm88kERE+0dKw=; b=dryKP/iYqcxwqgNxnPWMrH2HewxuXXyHhLAumb+q+ThatSMNZoXVsr7YQNPd6YsJh8 5vLVyJLmDTclZcPE7OHOKxXcqzTcQVYCMqAxRM+kSK5HvVxkbLF/9G86UiFlC2wcLi3k zaWCoQIOOEjX/EcyCOkml5yZImVDgbQfhZEbh+AI76G905WGMN4xG6VMs4xlgKrdqTUr RJx50QH18FlSR6nuamisyMBSmBw2rM9t42gBQUg9UJxkInMSTK/5gPPY3XOsdtv5ha9b sTKFR9BWYvAU5WjlSGj7iGEdUs/gPXrvpBIhsRtq0B0K9sLOnVpCjDKebtiYpbvvNIYM Nyaw== X-Gm-Message-State: AO0yUKW+tprLOhuqIrPZtiHja7ZUARF/RV2qFJTLjHxznzTZBsQ+Fchf Ao/vX9b6MQmRiwj8m/OZ+9s= X-Google-Smtp-Source: AK7set/X/gdso+MsOV2c5izN6qM1UseBpOFNhYseVRY1d3BJ3DKE6DR5oJFNXoVAXLqJK1jFetoe6w== X-Received: by 2002:a17:90b:1d90:b0:233:cd29:f168 with SMTP id pf16-20020a17090b1d9000b00233cd29f168mr37819300pjb.24.1678770144375; Mon, 13 Mar 2023 22:02:24 -0700 (PDT) Received: from localhost (KD036014041111.ppp-bb.dion.ne.jp. [36.14.41.111]) by smtp.gmail.com with ESMTPSA id l15-20020a17090a4d4f00b00232cf6186fdsm705340pjh.30.2023.03.13.22.02.20 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 13 Mar 2023 22:02:23 -0700 (PDT) Date: Tue, 14 Mar 2023 14:02:19 +0900 (JST) Message-Id: <20230314.140219.1927496956011370958.horikyota.ntt@gmail.com> To: sfrost@snowman.net Cc: pryzby@telsasoft.com, alvherre@alvh.no-ip.org, andres@anarazel.de, michael@paquier.xyz, nathandbossart@gmail.com, jchampion@timescale.com, john.naylor@enterprisedb.com, masao.fujii@oss.nttdata.com, noriyoshi.shinoda@hpe.com, pgsql-hackers@postgresql.org, rjuju123@gmail.com, sawada.mshk@gmail.com, tgl@sss.pgh.pa.us, thomas.munro@gmail.com Subject: Re: Improve logging when using Huge Pages From: Kyotaro Horiguchi In-Reply-To: References: User-Agent: Mew version 6.8 on Emacs 26.1 Mime-Version: 1.0 Content-Type: Text/Plain; charset=iso-2022-jp Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk At Mon, 13 Mar 2023 21:33:31 +0100, Stephen Frost wrote in > > On Thu, Mar 09, 2023 at 03:02:29PM -0500, Stephen Frost wrote: > > > * Justin Pryzby (pryzby@telsasoft.com) wrote: > > > Is there an agreement to use a function, instead ? > > > > Alvaro was -1 on using a function > > > I don’t entirely get that argument (select thisfunc(); is much worse than > show thisguc; ..? Also, the former is easier to use with other functions > and such, as you don’t have to do current_setting(‘thisguc’)…). > > Andres is +0 (?) > > > Kinda felt like this was closer to +0.5 or more, for my part anyway. > > Nathan is +1 > > Stephen is +1 > > > > I'm -0.5, > > > Why..? IMHO, it appears that we use GUC "internal" variables to for the lifespan-long numbers of a postmaster process or an instance. Examples of such variables includes shared_memory_size and s_m_s_in_huge_pages, integer_datetimes and data_checksums. I'm uncertain about in_hot_standby, as it can change during a postmaster's lifetime. However, pg_is_in_recovery() provides essentially the same information. Regarding huge_page_active, its value remains constant throughout a postmaster's lifespan. In this regard, GUC may be a better fit for this information. The issue with using GUC for this value is that the postgres command cannot report the final value via the -C option, which may be the reason for the third alternative "unknown". I slightly prefer using a function for this, as if GUC is used, it can only return "unknown" for the command "postgres -C huge_page_active". However, apart from this advantage, I prefer using a GUC for this information. If we implement it as a function, I suggest naming it "pg_huge_page_is_active" or something similar (the use of "is" is signinficant here) to follow the naming convention used in pg_is_in_recovery(). regards. -- Kyotaro Horiguchi NTT Open Source Software Center