Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uyk51-00C74w-OE for pgsql-committers@arkaria.postgresql.org; Wed, 17 Sep 2025 04:47:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1uyk4z-004qwD-Lt for pgsql-committers@arkaria.postgresql.org; Wed, 17 Sep 2025 04:47:42 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uyk4y-004qvA-Vw for pgsql-committers@lists.postgresql.org; Wed, 17 Sep 2025 04:47:42 +0000 Received: from fhigh-b8-smtp.messagingengine.com ([202.12.124.159]) by makus.postgresql.org with smtp (Exim 4.96) (envelope-from ) id 1uyk4x-000qB3-0m for pgsql-committers@lists.postgresql.org; Wed, 17 Sep 2025 04:47:40 +0000 Received: from phl-compute-12.internal (phl-compute-12.internal [10.202.2.52]) by mailfhigh.stl.internal (Postfix) with ESMTP id C66477A00E5; Wed, 17 Sep 2025 00:47:38 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-12.internal (MEProxy); Wed, 17 Sep 2025 00:47:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm1; t=1758084458; x=1758170858; bh=HvdDY1x5aA CcilWJfFCytgvjKX6MXDZzkmAlWHvYHtE=; b=VfyjndvUvpGQCnnnZaZrMAL3eu RoTHlrvbpbV+UNqi8vlAtPcCfP1/DDoN/JX9vH9mhzZqYzW2hZFtXonaKpt9Qbo/ NTrxrOiBzgWMs9j/0ZjgsvChOSyl225JbBglnRFQrE7+1L4NiwB/x5M/OEqd33g8 eIclO1giVen2BG/um3/bRExhcZE6u8M65B9etpqe+mrfnnDs4vPRjm7HZ/FRyp22 4hKJDsTZNyGRW6GiyEh/yVOMB6xWs1WKRRXXn4Jadb3w7dhOHmM8QVnp5QFhkMsG w47d3Wj7Jh40ukkD3AOJyNnWiLNzOXjoT2Fk0o0svI0xwkaaC8RIoo6YKKpg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1758084458; x=1758170858; bh=HvdDY1x5aACcilWJfFCytgvjKX6MXDZzkmA lWHvYHtE=; b=G3qoOFeLk7TkOnc535RDnYmohdc9Y8pnuKP0Vn5ZQysi3LPd6bs Mf7gFbcz6Bk1YFYuKoUGyzE/Uas4QNOuXshBDcA0Gf+VFL5SDyei5nRaVXq+sEfm mG0CVE1oNqSN2Ij5XhWZ10qtAC2dqclj+IDDW7DGX6URHRumYhaULwA6m9aZP+9Y fFV0Cgi0/lsZx3W3uGq5orhZd8M38GiTGffnkeP2m68oyJYmPPlHCcy5fe5FQZqC kwq2adjosF/VDXsh+mIa4Kd84WwR62VgvPaWcZSpY+PeRXliAWVsJNjrsflGmQ4P nwpbXc/ekArfupnjqbPiPJkjK/cb17cZUqg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggdegvdehfecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenfghrlh cuvffnffculdejtddmnecujfgurhepfffhvfevuffkfhggtggujgesghdtreertddtvden ucfhrhhomhepofhitghhrggvlhcurfgrqhhuihgvrhcuoehmihgthhgrvghlsehprghquh hivghrrdighiiiqeenucggtffrrghtthgvrhhnpeetleeifedufffhhfdtteelgeeggeff hfekueevteeigfduudevudetgfegiedvjeenucevlhhushhtvghrufhiiigvpedtnecurf grrhgrmhepmhgrihhlfhhrohhmpehmihgthhgrvghlsehprghquhhivghrrdighiiipdhn sggprhgtphhtthhopeefpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehnrghthh grnhgusghoshhsrghrthesghhmrghilhdrtghomhdprhgtphhtthhopehnrghthhgrnhes phhoshhtghhrvghsqhhlrdhorhhgpdhrtghpthhtohepphhgshhqlhdqtghomhhmihhtth gvrhhssehlihhsthhsrdhpohhsthhgrhgvshhqlhdrohhrgh X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 17 Sep 2025 00:47:36 -0400 (EDT) Date: Wed, 17 Sep 2025 13:47:19 +0900 From: Michael Paquier To: Nathan Bossart Cc: Nathan Bossart , pgsql-committers@lists.postgresql.org Subject: Re: pgsql: Move named LWLock tranche requests to shared memory. Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="fzdJtOfp2sscljUO" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --fzdJtOfp2sscljUO Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Sep 16, 2025 at 11:10:34PM -0500, Nathan Bossart wrote: > I was able to simplify the patch. + if (LocalNamedLWLockTrancheRequestArray) + NamedLWLockTrancheRequestArray = LocalNamedLWLockTrancheRequestArray; It's not a common practice in the code to rely on a shmem state that should be already set in a routine reporting the size of how much should be allocated, but that seems OK to live with that here with a local pointer used un !IsUnderPostmaster. Perhaps LocalNamedLWLockTrancheRequestArray should be initialized to NULL when declared, and I'd rather document the reasons behind what this patch is doing in LWLockShmemSize() and when the state is initialized in CreateLWLocks(), than have the reader assume why the local pointer is needed (aka reinitialized with restart_after_crash). 013, 022 and 041 look happy with this solution, with or without EXEC_BACKEND. Note: I forgot for a second if shared_preload_libraries was reloaded when the postmaster reinitializes a cluster, and the answer is that we only go into process_shared_preload_libraries() once at startup.. I was wondering for a second about a potential case where s_p_l is updated with more lwlocks added in-between, where a reinitialization would mess up things. -- Michael --fzdJtOfp2sscljUO Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmjKPVcACgkQnvQgOdby QH0kXA//XsJccs1hkn65I8/J+uZRD5+V5PMSTFClTUuh5ob529GvVle/vEfnvSWU NQNFw91t4DQjyAeqoS3HdJBYtWj9YZ22YzDxSFPPlSPiy+I7skoStZRxvOvjV1A8 fRPcxqOb+WBE6stBZSlCItbADxP6f/wij7/kWsGPn1+rQYwxJOJ2ZFPStmCDFQAi yxmdaocPe/FJuJkARzb3ZuUSgyPcccwVEryAVHLO2CPrHe9BII98WyRTFDx8vbbV c6pxym/lczm9t2BtU/42x5mvUP1Y3c0HxABd7knLrzH+mCdVZOyYqMGRoo1sF3KV pPq/NeLWr2UPuvPJIyX/Ks31D7sHy1BsNNZecXBmeqVc9Mrdaz42+KxFPofMGTFM n0BceIjv6DYGRbfQqnxt3h3nwCOR59//7/dcRQ+XXFETvzq3ES4kGHNUvnmt3Fib TFLvm0WeNc+QWShJhT8EW7ywWoM0tYIA5a6Ds8YoOLp7mcF7PisG/7hIzlrCus05 yQpZN8kauT7tuMdUXGoF1W3+oghtqs1NIFgII3VLHKAuIo7BGVJW91EGOvKoQJGi y7/TpPVVg1AU8SBW+vKX9sjIW4fhBnxD5KR59ObzV3oZHnmkx2Oke2sneDfJ8zuz qyrXRsHzoQyVIqlouKc+i37sEXPd9buKs3QZnkVKS/ykKaAFPKc= =l6A8 -----END PGP SIGNATURE----- --fzdJtOfp2sscljUO--