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.96) (envelope-from ) id 1w9ci5-001ayt-18 for pgsql-committers@arkaria.postgresql.org; Mon, 06 Apr 2026 05:41:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w9ci2-006jnt-28 for pgsql-committers@arkaria.postgresql.org; Mon, 06 Apr 2026 05:41:15 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w9ci2-006jnl-1J for pgsql-committers@lists.postgresql.org; Mon, 06 Apr 2026 05:41:14 +0000 Received: from fout-b6-smtp.messagingengine.com ([202.12.124.149]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1w9ci0-00000000qr6-0bYj for pgsql-committers@lists.postgresql.org; Mon, 06 Apr 2026 05:41:14 +0000 Received: from phl-compute-01.internal (phl-compute-01.internal [10.202.2.41]) by mailfout.stl.internal (Postfix) with ESMTP id 338E91D0004B; Mon, 6 Apr 2026 01:41:10 -0400 (EDT) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-01.internal (MEProxy); Mon, 06 Apr 2026 01:41:10 -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=fm2; t=1775454069; x=1775540469; bh=1zmnVcI+Gf PAOZX2/+SV8iiuEbRVDOz+CZT8Rp5HZ1Y=; b=RmkPtQjHQmvSitoosEdIB63S8s Y+E5kFFNxnJn13wZLrdxnsZ4/7Iey9ON6y5E5L7eNfbCG74OBWKJ2sdWjwlZiChx OR6EuMKWEp9VTzAKma7ezhhnuQW9O+EX6QIagEUjDIge2FIOVFu+lsf2rtzOFUJk cSY/Yw/2ESGdFffS3GtHRUNRxNyXjLf+GANMtcFErAOn11YJE47Al6Xkz29vnFyz hJx3wlN4pO4TR3dpsZyLbbQstCVWLbGNS53T1NCKg+mLxShVAsLU8dcsT9ujWCEc cuEjV76Ur5JAubyoKXln5laWhSYtL9wrfVndWcceNn6kmDeF7sz9yXJNOwAA== 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=fm2; t= 1775454069; x=1775540469; bh=1zmnVcI+GfPAOZX2/+SV8iiuEbRVDOz+CZT 8Rp5HZ1Y=; b=AhEN1Iix4uEH06rsnocXjKsct/Bt5t55q9B/mQOguqT/GZzmRK9 dxIc8yvf4WJ5aBoN8ChhBprLHYwKu87+hsMQWUhrigkWy+b+3rxnLSb3JRYdmpDn 3k0q34MsRZOOumBRpazYiS0A9zg60hST+FYLUaztGXPk2Zl+sgzDZpgaRvJjpHzQ XhD5tLbHLhe29AtoPnVYxR2uvOUuoFNKsm5oL+WtvIsBJOUGWPvNFptr5Eisfh4h J+NxH9g189tAqIvon5h8O2hyplu7dVrkPkYam20MK8V3dC6Up9cF9CJvI5Lm9/jS 7kZXBcjdx+2XV73RA7xhI5MhPimI9aQSQwA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefhedrtddtgdduieekjecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenfghrlh cuvffnffculdefhedmnecujfgurhepfffhvfevuffkfhggtggujgesghdtreertddtvden ucfhrhhomhepofhitghhrggvlhcurfgrqhhuihgvrhcuoehmihgthhgrvghlsehprghquh hivghrrdighiiiqeenucggtffrrghtthgvrhhnpeegffejvefgveduvdejtddvtdeijeeh udeuledvudeftdfgfeejvdekveekiedvvdenucffohhmrghinhepphhoshhtghhrvghsqh hlrdhorhhgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhho mhepmhhitghhrggvlhesphgrqhhuihgvrhdrgiihiidpnhgspghrtghpthhtohepvddpmh houggvpehsmhhtphhouhhtpdhrtghpthhtohephhgvihhkkhhirdhlihhnnhgrkhgrnhhg rghssehikhhirdhfihdprhgtphhtthhopehpghhsqhhlqdgtohhmmhhithhtvghrsheslh hishhtshdrphhoshhtghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 6 Apr 2026 01:41:08 -0400 (EDT) Date: Mon, 6 Apr 2026 14:41:04 +0900 From: Michael Paquier To: Heikki Linnakangas Cc: pgsql-committers@lists.postgresql.org Subject: Re: pgsql: Convert all remaining subsystems to use the new shmem allocation Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="WdsnfE7WZSwEFt6J" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --WdsnfE7WZSwEFt6J Content-Type: multipart/mixed; boundary="SapiwxDjMKG/AILm" Content-Disposition: inline --SapiwxDjMKG/AILm Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Apr 05, 2026 at 11:27:44PM +0000, Heikki Linnakangas wrote: > Convert all remaining subsystems to use the new shmem allocation API >=20 > This removes all remaining uses of ShmemInitStruct() and > ShmemInitHash() from built-in code. > > src/backend/utils/misc/injection_point.c | 57 ++++--- drongo, that compiles without USE_INJECTION_POINTS, is complaining about this bit around line 240: const ShmemCallbacks InjectionPointShmemCallbacks =3D { #ifdef USE_INJECTION_POINTS .request_fn =3D InjectionPointShmemRequest, .init_fn =3D InjectionPointShmemInit, #endif }; Link: https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=3Ddrongo&dt=3D2026-= 04-06%2004%3A09%3A20 And the error: =2E./pgsql/src/backend/utils/misc/injection_point.c(240): error C2059: synt= ax error: '}' Why not putting the whole InjectionPointShmemCallbacks inside a USE_INJECTION_POINTS block? We should not care about shmem allocations when --enable-injection-points is not used. subsystemlist.h expects the callbacks to always be defined, so your intention is to have no ifdefs there. Still, it seems a bit pointless to me to define callbacks we are not going to use depending on the build options evoked? Attached is one idea, which I doubt you'll like. :) -- Michael --SapiwxDjMKG/AILm Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=inj-shmem-subsystem.patch Content-Transfer-Encoding: quoted-printable diff --git a/src/include/storage/subsystemlist.h b/src/include/storage/subs= ystemlist.h index 5e092552c725..9ad619080be2 100644 --- a/src/include/storage/subsystemlist.h +++ b/src/include/storage/subsystemlist.h @@ -79,7 +79,9 @@ PG_SHMEM_SUBSYSTEM(SyncScanShmemCallbacks) PG_SHMEM_SUBSYSTEM(AsyncShmemCallbacks) PG_SHMEM_SUBSYSTEM(StatsShmemCallbacks) PG_SHMEM_SUBSYSTEM(WaitEventCustomShmemCallbacks) +#ifdef USE_INJECTION_POINTS PG_SHMEM_SUBSYSTEM(InjectionPointShmemCallbacks) +#endif PG_SHMEM_SUBSYSTEM(WaitLSNShmemCallbacks) PG_SHMEM_SUBSYSTEM(LogicalDecodingCtlShmemCallbacks) PG_SHMEM_SUBSYSTEM(DataChecksumsShmemCallbacks) diff --git a/src/backend/utils/misc/injection_point.c b/src/backend/utils/m= isc/injection_point.c index a7c99e097ea4..aa455c62bcc0 100644 --- a/src/backend/utils/misc/injection_point.c +++ b/src/backend/utils/misc/injection_point.c @@ -230,19 +230,15 @@ injection_point_cache_get(const char *name) =20 return NULL; } -#endif /* USE_INJECTION_POINTS */ =20 const ShmemCallbacks InjectionPointShmemCallbacks =3D { -#ifdef USE_INJECTION_POINTS .request_fn =3D InjectionPointShmemRequest, .init_fn =3D InjectionPointShmemInit, -#endif }; =20 /* * Reserve space for the dynamic shared hash table */ -#ifdef USE_INJECTION_POINTS static void InjectionPointShmemRequest(void *arg) { @@ -259,7 +255,7 @@ InjectionPointShmemInit(void *arg) for (int i =3D 0; i < MAX_INJECTION_POINTS; i++) pg_atomic_init_u64(&ActiveInjectionPoints->entries[i].generation, 0); } -#endif +#endif /* USE_INJECTION_POINTS */ =20 /* * Attach a new injection point. --SapiwxDjMKG/AILm-- --WdsnfE7WZSwEFt6J Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmnTR3AACgkQnvQgOdby QH2rAg//adixFij0KpNk+bWLLFiskz8E7ATD8b9azUZdUcy6cp36eKKPKvpwW5C5 gprtq8Dww1fD+7zjAMnqhqKpwfhFe0Fg3rs2s/lmQJ0LW6CMSj6Kc4vtRiw7yI0g t7C3BxgIltwbQ7aMLJxUk+qoUu7iMpD2NVI8YH2L74Z2eraC6EcGfa86/4XxFjw3 QD/ySCiATMh0MbGRqzAsqcw9qNHwXh08vK0jcrm+jGWcAfWU0nL3Tud17l//KmUM rAMynsUN/6kz63QOgvmsqNFS3AkDdmC/I2hnyltRUtRUOnKmtz+xerVKTVm/JhnE Q4kVyvR2Hs9znNRZiihfRQVUDog5Pc58WpgP7HozmCFVK19c3MldZYheeMPqf0Uv 1w63Vo2SuJU3f6IUBJJf20oKQXIVAO6Nu0WEaVC8UbB/QcQcSOioXmpZ4PghhI3B UZNaoV56HSdpb5ORQOsVGX1MLjIF9/pHI2PMYG5vEzg2OPPU6KtTJj0jEel+vmfI Xbh2HfnQq89etSCFZItUieISwtiiuLr05coHo751jm4+LiqO3r7XTeYZWV/hC4j2 E8TyDY3oRdYrj77N4xXUQmbPQ/dUChwzRNFtB/u3XrM95GDQJzKtO5hKh4asCzBW zOH/EnO6cUOuD9SpfO7BqqSEkQEbr/2ihW0UEDB493RLerEpkHI= =Q5PO -----END PGP SIGNATURE----- --WdsnfE7WZSwEFt6J--