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 1mN4MP-0002b0-NN for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Sep 2021 02:27:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mN4MN-00069s-D4 for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Sep 2021 02:27:47 +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 1mN4MM-00069k-6s for pgsql-hackers@lists.postgresql.org; Mon, 06 Sep 2021 02:27:47 +0000 Received: from wout4-smtp.messagingengine.com ([64.147.123.20]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mN4MJ-00059u-7o for pgsql-hackers@postgresql.org; Mon, 06 Sep 2021 02:27:44 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 54BCF320084E; Sun, 5 Sep 2021 22:27:41 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Sun, 05 Sep 2021 22:27:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm2; bh=K1EB+wxlQvCZUcJl/xFx2fYvWRq HHvdOWTvu3+qDSKQ=; b=HustoaiknDb4wulne1oPXDwdl/YJqNecUbPNVMVnuRb 8lzAXo8epsg3q6KXy2sxUByc0KOLs9Bpnubaofw5Zly5xIcuU2/YFThQWbMU486J HDHw0xwIb6W0cMxyS/ccTzbhoX5OI0q1J1Ggex8p/dd1zsx6616u03mLTXn1TtRw O3Gp/Q4BGWxWSzqflkLqszselsMZgbaNH9qHZhz356Lirk5B/ABjF/3sBD5KfBE9 QLoSitPKHMOvWF+A3rBq76fNp1XaFPrUQ1F/QA02Fucod6yYmWvUgrCRhdkeKq9j jtm8vF4zgBq27n4P2/fjLG5OHdX/ialM9fF9jV4uNBw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=K1EB+w xlQvCZUcJl/xFx2fYvWRqHHvdOWTvu3+qDSKQ=; b=Nz3/Mkj/Gh8VOJb2cWkwwj 5/jeaoSATGt4nhh7f2jAmKl2/sTTReIjFS0fcCBGdIoZY/KZuhfxsDyE/jQHPhL6 D2XBT3jDW80/a0s0gj1vLdTTIbOT6MGKhsW3qAwHJwGm39FYiCV2c00v3a8Ksb7j f4Oks9hlkImEZJ8tWBxIow1hIWf5ysCehNgRUJlc2Usvz5QtJiZoijiK8kL1oSte G81XogBgBZZcakE/xpt/KCtcKUsCMs/7GdHQWHOGIEGneSf3Pl7Sogl1SYWXDWF1 dekB5b7xezL3yyYkmuz/L03OFZfAA+e3ataTl1r4hww3ZFy1SeGyRAr44TKnV/gg == X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrudefvddggeekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne gfrhhlucfvnfffucdljedtmdenucfjughrpeffhffvuffkfhggtggujgesghdtreertddt vdenucfhrhhomhepofhitghhrggvlhcurfgrqhhuihgvrhcuoehmihgthhgrvghlsehprg hquhhivghrrdighiiiqeenucggtffrrghtthgvrhhnpedvgeduuefhtdeuleettdevjeeh heeiveeuieegleetgeeljeelieeuieehgeevhfenucevlhhushhtvghrufhiiigvpedtne curfgrrhgrmhepmhgrihhlfhhrohhmpehmihgthhgrvghlsehprghquhhivghrrdighiii X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 5 Sep 2021 22:27:38 -0400 (EDT) Date: Mon, 6 Sep 2021 11:27:35 +0900 From: Michael Paquier To: "Bossart, Nathan" Cc: Justin Pryzby , Andres Freund , Magnus Hagander , Mark Dilger , Don Seiler , "pgsql-hackers@postgresql.org" Subject: Re: Estimating HugePages Requirements? Message-ID: References: <20210828035722.GQ26465@telsasoft.com> <82E1E183-691F-479E-B661-9BE8EC70BD21@amazon.com> <48795AC4-289F-4CDE-88F5-4FD1ED2BD3DD@amazon.com> <298B6D88-7B71-4E1B-BFC4-E7BF3A32960D@amazon.com> <23F67FC0-E432-4324-BEA4-F99B126510EA@amazon.com> <7ED221D0-0D75-46F8-8D6C-8AF70D8EABE7@amazon.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="mAzEGLBLNe2BZ1mH" Content-Disposition: inline In-Reply-To: <7ED221D0-0D75-46F8-8D6C-8AF70D8EABE7@amazon.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --mAzEGLBLNe2BZ1mH Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Sep 03, 2021 at 05:36:43PM +0000, Bossart, Nathan wrote: > On 9/2/21, 6:46 PM, "Michael Paquier" wrote: > You bring up an interesting point about _PG_init(). Presently, you > can safely assume that the data directory is locked during _PG_init(), > so there's no need to worry about breaking something on a running > server. I don't know how important this is. Most _PG_init() > functions that I've seen will define some GUCs, request some shared > memory, register some background workers, and/or install some hooks. > Those all seem like safe things to do, but I wouldn't be at all > surprised to hear examples to the contrary. In any case, it looks > like the current ordering of these two steps has been there for 15+ > years. Yeah. What you are describing here matches what I have seen in the past and what we do in core for _PG_init(). Now extensions developers could do more fancy things, like dropping things on-disk to check the load state, for whatever reasons. And things could break in such cases. Perhaps people should not do that, but it is no fun either to break code that has been working for years even if that's just a major upgrade. + * We skip this step if we are just going to print a GUC's value an= d exit + * a few steps down. */ - CreateDataDirLockFile(true); + if (output_config_variable =3D=3D NULL) + CreateDataDirLockFile(true); Anyway, 0002 gives me shivers. > If this is a concern, one option would be to disallow running "-C > shared_memory_size" on running servers. That would have to extend to > GUCs like data_checksums and huge_pages_required, too. Just noting this bit from 0003 that would break without 0002: -$ pmap 4170 | awk '/rw-s/ && /zero/ {print $2}' -6490428K +$ postgres -D $PGDATA -C shared_memory_size +6339 >> 0001, that refactors the calculation of the shmem size into a >> different routine, is fine as-is, so I'd like to move on and apply >> it. >=20 > Sounds good to me. Applied this one. Without concluding on 0002 yet, another thing that we could do is to just add the GUCs. These sound rather useful on their own (mixed feelings about huge_pages_required but I can see why it is useful to avoid the setup steps and the backend already grabs this information), particularly when it comes to cloned setups that share a lot of properties. -- Michael --mAzEGLBLNe2BZ1mH Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmE1fJYACgkQnvQgOdby QH3t3g//U67dk/bPJwnRoE4uPfnkFcYoqfSSZN5GsWHPRrfRApwLoe+oB/m5voBw wHnhDdFrq7P1mEuL8G2W4TTQg64A9BdA+0TjgC8MYGFFLepAm7tbu9YOGeVsDICN u4mCtT7M3I6C0tlQcZgaJ3f5cRzZApiyKCQs/wkNXl8emDx1AlmnZXQAL2eFPn4a B0F7xPdkxgu0wq1hYcwal50Qxc1LAwa1WKNZDuwRm5raxfke7lzDgZA+eCAPx/7f /xIY9LAIDl7STx5AIeSHG9di0YIHE6gsFARW6nGyaL5OBuz4PWq2J+O4yRcVCdsa pUe4MlxtRTQWmT+3i6n68zWw3FmmLc/nRqYj5rZd15gQD3v/k6Yuy6QbU5VeDoAZ hteeWlHWbcuIpTmwxff02wE2+D/Y/HbsiGJ4HeH2F9GgrLGKXMwx8Yj2RG8dTxuU IG4aAy2qODmJkX0ZiKs9krMWy4IIYl0OBddlm1kVh8rV1gOJlBGOOa5vOMwEvber tQpq3gmTwMGUZoFU48JHZBeg/zQLZThxC4jGSIEZs1apzGLQdeyDppjuA0OtTG0n rD3+0hHuffICF/vCbqR5mu0uTIjYAWLWfHyIzEGYKNcsQB6UhejjaDeyD7tBhTBU Hcfcu6QsQKr6vWvdprs1BDdvgUXXSnkM6Tmi0L5oKajbA7Poro8= =EnWS -----END PGP SIGNATURE----- --mAzEGLBLNe2BZ1mH--