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 1tZqd1-00DeUz-S9 for pgsql-hackers@arkaria.postgresql.org; Mon, 20 Jan 2025 12:11:40 +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 1tZqd0-001RcU-1d for pgsql-hackers@arkaria.postgresql.org; Mon, 20 Jan 2025 12:11:38 +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 1tZqcz-001RcL-BE for pgsql-hackers@lists.postgresql.org; Mon, 20 Jan 2025 12:11:38 +0000 Received: from fhigh-a1-smtp.messagingengine.com ([103.168.172.152]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tZqcw-000Wxc-1q for pgsql-hackers@lists.postgresql.org; Mon, 20 Jan 2025 12:11:37 +0000 Received: from phl-compute-05.internal (phl-compute-05.phl.internal [10.202.2.45]) by mailfhigh.phl.internal (Postfix) with ESMTP id 3FCC31140211; Mon, 20 Jan 2025 07:11:33 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-05.internal (MEProxy); Mon, 20 Jan 2025 07:11:33 -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=1737375093; x=1737461493; bh=smGRp48uL5 wkv0qTlfn5/77YD7DStwVWOjsq2vYgzPU=; b=lOX7+XVSYI35Gz9xfemiOif9Wv +a+498iGmMgrQhHz9TQu6UHh1fxL3vdZ71YmqPBA7dkzk384NRFfEhQPIIc9S6Yu 7pNoVZIu9X8OV58VaeiLqSvNsKJqsBZ2N+gHojjlq2h4mJH2jVv8RWXG1gO+jxm2 0z79jNG/KHeURrPyyAJlu8m5eWTZMYo0gu2S1ziArJeEt5pXon/vRaZK7ZyVLtRM ADArDyZjZ9fTGyWIejJi4vVZ3oyWSuns9Zd32L2boC+5/nyc4hAGucuvwRBS0mnF L/TGk1W3JsDcRU3JJxHaTYxHmbhpDPht4g+DexIpUlWlhLnWCEzSfdgpBdnA== 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= 1737375093; x=1737461493; bh=smGRp48uL5wkv0qTlfn5/77YD7DStwVWOjs q2vYgzPU=; b=fDdS2TZWGCN1JmsMf5ldssxuE8FIC0E0zYqdXjXjQznIzaupvTI vsVxAE/Wdt7h6nl6CRqj0HCZ5+LWuSY4zTQQo3epf+BoTJkoV4HrB3HN2Ui+9hpG mLO2+uX1HlKp40EK86Rl+okKp5UJKjBomTj6BelgtKBvIf3GbPx+8YBJtVSftMp2 iuHie7aibUErlmeEu9p/R3+g7IZBFl2f+uR/rppvQSTUmZyJQ/bhFaIxZdUqPZeY TwxEDdhrIoBRETvgee3/S/QxgqwT4oGmc0/SS4LXUvtFapdu09VzkMnwdBR/fW6h s+2v73eT08REMIzU904cwMXZpQLz1fY7wMA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrudeiledgfeefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnegfrhhlucfvnfffucdljedtmdenucfjughrpeffhffvvefukfhf gggtuggjsehgtderredttddvnecuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruc eomhhitghhrggvlhesphgrqhhuihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepteel ieefudffhffhtdetleeggeegfffhkeeuveetiefgudduvedutefggeeivdejnecuvehluh hsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepmhhitghhrggvlhes phgrqhhuihgvrhdrgiihiidpnhgspghrtghpthhtohepiedpmhhouggvpehsmhhtphhouh htpdhrtghpthhtohepsggvrhhtrhgrnhguughrohhuvhhothdrphhgsehgmhgrihhlrdgt ohhmpdhrtghpthhtoheprghnughrvghssegrnhgrrhgriigvlhdruggvpdhrtghpthhtoh epsgihrghvuhiikedusehgmhgrihhlrdgtohhmpdhrtghpthhtoheprghlvhhhvghrrhgv segrlhhvhhdrnhhoqdhiphdrohhrghdprhgtphhtthhopehhohhrihhkhihothgrrdhnth htsehgmhgrihhlrdgtohhmpdhrtghpthhtohepphhgshhqlhdqhhgrtghkvghrsheslhhi shhtshdrphhoshhtghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 20 Jan 2025 07:11:30 -0500 (EST) Date: Mon, 20 Jan 2025 21:11:16 +0900 From: Michael Paquier To: Bertrand Drouvot Cc: Andres Freund , Nazir Bilal Yavuz , Alvaro Herrera , Kyotaro Horiguchi , pgsql-hackers@lists.postgresql.org Subject: Re: per backend I/O statistics Message-ID: References: <66efowskppsns35v5u2m7k4sdnl7yoz5bo64tdjwq7r5lhplrz@y7dme5xwh2r5> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="/4nRbYgHmZFcycDN" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --/4nRbYgHmZFcycDN Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jan 20, 2025 at 11:10:40AM +0000, Bertrand Drouvot wrote: > I think that it would be better to make the distinction based on "local/s= tatic" > vs "dynamic memory" pending stats instead: I did so in v3 attached, using: >=20 > .flush_dynamic_cb(): flushes pending entries tracked in dynamic memory > .flush_static_cb(): flushes pending stats from static/global variable "static" and "dynamic" feel a bit off when used together. For "static", the stats are from a static state but they can be pushed to the dshash, as well, which is in dynamic shared memory. Hmm. Thinking more about that, I think that we should leave the existing "flush_pending_cb" alone. For the two others, how about "have_static_pending_cb" and "flush_static_cb" rather than "fixed"? It seems important to me to show the relationship between these two. > Not sure about this one, see above. I mean it is currently Ok but once we= 'll > introduce the WAL part then it will not be correct depending of the flag = value > being passed. >=20 > So, I did put back the previous logic in place (setting to zero only the = stats > the flush callback is responsible for) in v3 attached. Hmm. I think that I'm OK with what you are doing here with the next parts in mind, based on this argument. > I don't think setting have_backendstats to false in pgstat_flush_backend() > is correct. I mean, it is correct currently but once we'll add the WAL pa= rt it > won't necessary be correct if the flags !=3D PGSTAT_BACKEND_FLUSH_ALL. So= , using a=20 > pg_memory_is_all_zeros check on PendingBackendStats instead in the attach= ed. Indeed. I got this part slightly wrong here. What you are doing with an all-zero check looks simpler in the long run. -- Michael --/4nRbYgHmZFcycDN Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmeOPWQACgkQnvQgOdby QH0Opg//Sd7mS2Ck8Vj+7MRtKsVSThF63StgHphoIQFOdE5ui7AeQCEcuZR61gfq yrQok6AEbVvGyGi0Ljohq+Yvn7tzUD3VIWM9sBbG7qgnWrgTgkL4Z+3WVKQ0AhOv FL7/KwIxw1lNUoNVrxgiLjwkA9eSOE2YKC9U0FTBrvWF1kVISAyB+6aCl/wabEvx hHb+ufmn7hzb4RueiOWX8p8jk3qNcoLC5sE0HrAWqxK2FGUzCoSl//R51Z8MtKuM 6XMwnjrzYbCUQb1u2J/nq7F4H6btCCup8ewl+08I/MKnsuDp66OR6WqopwfFfgHJ 8gRbokHxSgC9quyUY0yVHAI9nq5K5eTbX0sMjXH7HHBlNMG3Rf3NGH8DAwhkAvYD 6qbEiI/LvtuUBiR5671okfY0QzMYcvFAJ5xku8YTsQPkRlzxCddJQQYAMkwKbWMi tSESz6wMg2tWY5qgbSR/3C/hs7iPzrBeu332vfsaKlFIoo1tgAiL5/7eZEzbx4rT 7+dVUcJuQpQ/RYNoTKLy4imzM4uxF9z2ZyS1o2aE0cYxwt/iWNyazhRDlNpd/T/2 He89Q/ID9dhwkxOA3ELFI5LPNCf2gZBNNEaVtUjK+p1b7l/BVDBqRC12CfB5wrdG mDGT9ifY83HQm85tUarl3BPUnXzPxKkNUcHpRYs391xqNxrRins= =sKYF -----END PGP SIGNATURE----- --/4nRbYgHmZFcycDN--