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 1tXwdA-00Gsir-0o for pgsql-hackers@arkaria.postgresql.org; Wed, 15 Jan 2025 06:11:56 +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 1tXwd8-007iD2-IF for pgsql-hackers@arkaria.postgresql.org; Wed, 15 Jan 2025 06:11:55 +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.94.2) (envelope-from ) id 1tXwd7-007iCu-Ga for pgsql-hackers@lists.postgresql.org; Wed, 15 Jan 2025 06:11:54 +0000 Received: from fhigh-a4-smtp.messagingengine.com ([103.168.172.155]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tXwd4-000V0L-2m for pgsql-hackers@lists.postgresql.org; Wed, 15 Jan 2025 06:11:53 +0000 Received: from phl-compute-11.internal (phl-compute-11.phl.internal [10.202.2.51]) by mailfhigh.phl.internal (Postfix) with ESMTP id 583D9114008D; Wed, 15 Jan 2025 01:11:48 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-11.internal (MEProxy); Wed, 15 Jan 2025 01:11:48 -0500 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=1736921508; x=1737007908; bh=MAmkA6ulXm 5/D85iTm6MiXdJD7zHf520ITzQDQ2vzxI=; b=iLUgGK3oUcoCUf7UWJg7HrIBup 09pHnqwp4mAHgJmoDXBpMouSOInCrENQ1Z4Tr0SspQweg3NuksCGMqct/ioN/5i/ kD0tr1m2xqptLo5Ih0XkdZjEXuO3WoI2GzXu+qMVQhlwznrjYAZkjVIqM6ViHGl2 K1ShNQlMpYIVWX7gdU2cIfbldREd4+s7998N9+5V2h2e8lPkjFUSDUXDNbjV3Flu tqQ6R3L3iuzROQOzWQJi0wR1EVS1IumvV2woDMCR2kAWVSIaq6wC94fMGV2Bbc2m wflGhchkkdnwyQUxrvRRC/d7Yp6vXVRxKN/aNpbr9N8ipU9alMYGWdzw/LOA== 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= 1736921508; x=1737007908; bh=MAmkA6ulXm5/D85iTm6MiXdJD7zHf520ITz QDQ2vzxI=; b=cYmLPBAzSRnRfLLBgEmBanPqbIHx6shFHmjrlqre/rJ9lxHBphF fgdVfqcHm1gK7ndfHr7ptJO0Etiu4jM/efQX0kQ6h3963TNehj6lvFRWsr2LL8dL JqMLlur+mKTuZMTe7kvTtTrU2xyzQSwvzVdWXG2bcJQZMaTcCmYY8N1vPS4453mQ LdgyqhYvoqCJKFesep0QvnDjIsTezcofB+x4V6ssdePGCiy6FK00cDHvbb22cx6o qGGBkm49yherlEFHBu2Z0ldtwiTzlha9XCha9G65Le6C5g6qdM/S+aT228p2hY3A ml0DqOPjBA4B3vsoYrWsvaCi6La22kJRgEg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrudehjedgledtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucgfrhhlucfvnfffucdlje dtmdenucfjughrpeffhffvvefukfhfgggtuggjsehgtderredttddvnecuhfhrohhmpefo ihgthhgrvghlucfrrghquhhivghruceomhhitghhrggvlhesphgrqhhuihgvrhdrgiihii eqnecuggftrfgrthhtvghrnhepteelieefudffhffhtdetleeggeegfffhkeeuveetiefg udduvedutefggeeivdejnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrg hilhhfrhhomhepmhhitghhrggvlhesphgrqhhuihgvrhdrgiihiidpnhgspghrtghpthht ohepvddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepsggvrhhtrhgrnhguughroh huvhhothdrphhgsehgmhgrihhlrdgtohhmpdhrtghpthhtohepphhgshhqlhdqhhgrtghk vghrsheslhhishhtshdrphhoshhtghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 15 Jan 2025 01:11:46 -0500 (EST) Date: Wed, 15 Jan 2025 15:11:32 +0900 From: Michael Paquier To: Bertrand Drouvot Cc: pgsql-hackers@lists.postgresql.org Subject: Re: per backend WAL statistics Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="dEJPkOWmqRY5LZah" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --dEJPkOWmqRY5LZah Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Jan 10, 2025 at 09:40:38AM +0000, Bertrand Drouvot wrote: > Please find attached v4 taking into account 2c14037bb5. +} PgStat_WalCounters; + +typedef struct PgStat_WalStats +{ + PgStat_WalCounters wal_counters; I know that's a nit, but perhaps that could be a patch of its own, pushing that to pg_stat_wal_build_tuple() to reduce the diffs in the main patch. - * Find or create a local PgStat_BackendPending entry for proc number. + * Find or create a local PgStat_BackendPendingIO entry for proc number. Seems like you are undoing a change here. + * WAL pending statistics are incremented inside a critical section + * (see XLogWrite()), so we can't use pgstat_prep_pending_entry() and we rely on + * PendingBackendWalStats instead. + */ +extern PGDLLIMPORT PgStat_PendingWalStats PendingBackendWalStats; Hmm. This makes me wonder if we should rethink a bit the way pending entries are retrieved and if we should do it beforehand for the WAL paths to avoid allocations in some critical sections. Isn't that also because we avoid calling pgstat_prep_backend_pending() for the I/O case as only backends are supported now, discarding cases like the checkpointer where I/O could happen in a critical path? As a whole, the approach taken by the patch is not really consistent with the rest. -- Michael --dEJPkOWmqRY5LZah Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmeHUZQACgkQnvQgOdby QH2gkA/8CF1s6WV+jcgzeYYo6/fb6Mj731L7E69p1hh2n/VkucvyZwby7Q0xWj6O yNEouaSPEVDXXzpiwLpb6TF+YlcvoZbgwjY3a/NSehjJv6J5xtUlHH7j5yqWV9Df rRVTRWcU8q7l2zejbAjUte3ZS1gTHRCJMenHnNuGtJNs5BPP336gdiWb0XADBcVX aW/HwYSePdKq919VMNDSjtDY3RcURoF+bB40qJeW1G0ze9I5OZVM6NvocajlJpq/ C0tCwlNxiXOmad4SiKIPPHVjXARO3EYsjHybX8SuOtKYM+2IDS77OA3QPUpfSG6t LIsShmh/EclImc2OGD3zvoYOeImJxYDUbFYrkP/9rNab59woJfx00JoWbYlfIrON 3wMvPTGGTls22DtazXfufcVBvvwofonYshiWuahZ1is8914L9wNgNyQPQ+hMrKZB O6IBqDGL7TvRCvXP5ZRZ4WewqGmxJBEprOYclA4li3TEqRknrkUXR3E3fD1TlraC RNPaG/tTgMY5/GSxOyZaoiTLN6FY09baoD1B2cdEFkDeakmfwigSH+cVzQiNNuV+ ATCzV6l6ZlSdSA85zIjxAwdIa0EViGx53jEX7TuYSnH3n+BAQtJXEfilx1PBPTmJ pKj6Vdv/vtR0+qdWsIZEcp0FnkPVDZKOQ6QDdJWNfyRb2c6LRck= =W4v1 -----END PGP SIGNATURE----- --dEJPkOWmqRY5LZah--