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 1tN69G-008Yrt-VA for pgsql-hackers@arkaria.postgresql.org; Mon, 16 Dec 2024 08:08:15 +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 1tN69C-004CWK-VM for pgsql-hackers@arkaria.postgresql.org; Mon, 16 Dec 2024 08:08:12 +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 1tN69C-004CWB-5S for pgsql-hackers@lists.postgresql.org; Mon, 16 Dec 2024 08:08:11 +0000 Received: from fout-a5-smtp.messagingengine.com ([103.168.172.148]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tN69A-0036oa-OY for pgsql-hackers@lists.postgresql.org; Mon, 16 Dec 2024 08:08:10 +0000 Received: from phl-compute-06.internal (phl-compute-06.phl.internal [10.202.2.46]) by mailfout.phl.internal (Postfix) with ESMTP id 988D81383E5F; Mon, 16 Dec 2024 03:08:06 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-06.internal (MEProxy); Mon, 16 Dec 2024 03:08:06 -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=fm1; t=1734336486; x=1734422886; bh=fU5JgmHqVE gXpSK+cNDULVye/moU/HwR5M5wywGIItY=; b=QqsLgeSKZfQQeGU6LB7q/ctsrL rjXrAJ87HhtWgEcLCJfX5dfQAIDnw7fvo6+Ks7ekOtOSooegzr00L7jRTb+66tRG OMosrCn9eheVxrTX1iJTbgpe7HMQn7QHLCIQrqmgYfDXznzsHGNHLxUB6igWThRW kNNDgth8weRmw9zXQGRMQy2MEEeuFVn8J+ERTpI31HheJ7FI9WHIDdXqa0ELsV4V efcVeQeJ2ROqJJpD3/fh9VDTHeovSt+i74vJ2UulANF+5rbkbOskofo1pzY0T6dI Qe7L4leJGkAkaARfBZ22XeJwLNAPwAg2nVa5ClVuCpNKpJ3ZX4wR9xksLtFg== 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= 1734336486; x=1734422886; bh=fU5JgmHqVEgXpSK+cNDULVye/moU/HwR5M5 wywGIItY=; b=MsI6nN9RLbXNL18xhTx9/GYdnoa8LKyL0PFKiNW/tHwuRFp/sEh CkRRgg92w6TQFRYCK6fM8CVN9xELqie7XbgFTsLmjLBwGm643CQ9ixJpNmUBrhxx WXnKHtZONrd131ZLvbnha1EQp68C5JoZIR1LGdIhWfEq/r9K7aTOLZovvJ5GHWXg ZYiFh05xyyyRaH7Sh6of060GANNLmwJu3Q7IjWuKj+xzivL/u5UehMGeu9q4lToE oLLtZbODps861M3018c4S+O+zDWoixAxf9sXmlMOa+zKS4tauAdEG9cECwjYjDaS sPkxOT3swBm/RMk+uq82Lm8dLkMQ39shPMw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrledvgdduudehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnegfrhhlucfvnfffucdljedtmdenucfjughrpeffhffvvefukfhf gggtuggjsehgtderredttddvnecuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruc eomhhitghhrggvlhesphgrqhhuihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepteel ieefudffhffhtdetleeggeegfffhkeeuveetiefgudduvedutefggeeivdejnecuvehluh hsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepmhhitghhrggvlhes phgrqhhuihgvrhdrgiihiidpnhgspghrtghpthhtohephedpmhhouggvpehsmhhtphhouh htpdhrtghpthhtohepsggvrhhtrhgrnhguughrohhuvhhothdrphhgsehgmhgrihhlrdgt ohhmpdhrtghpthhtohepsgihrghvuhiikedusehgmhgrihhlrdgtohhmpdhrtghpthhtoh eprghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrghdprhgtphhtthhopehhohhr ihhkhihothgrrdhnthhtsehgmhgrihhlrdgtohhmpdhrtghpthhtohepphhgshhqlhdqhh grtghkvghrsheslhhishhtshdrphhoshhtghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 16 Dec 2024 03:08:04 -0500 (EST) Date: Mon, 16 Dec 2024 17:07:52 +0900 From: Michael Paquier To: Bertrand Drouvot Cc: Nazir Bilal Yavuz , Alvaro Herrera , Kyotaro Horiguchi , pgsql-hackers@lists.postgresql.org Subject: Re: per backend I/O statistics Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="2JGdTg12ZKrKP4HO" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --2JGdTg12ZKrKP4HO Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Dec 13, 2024 at 09:20:13AM +0000, Bertrand Drouvot wrote: > Yeah makes sense, that's consistent with other kinds: done. This looks to be taking shape. I don't have much more comments. Not feeling so sure about the value brought by the backend_type returned in pg_stat_get_backend_io(), but well.. + /* drop the backend stats entry */ + pgstat_drop_entry(PGSTAT_KIND_BACKEND, InvalidOid, MyProcNumber); Oh, I've missed something. Shouldn't pgstat_request_entry_refs_gc() be called when this returns false? The creation of the dshash entry is a bit too early, I think.. How about delaying it more so as we don't create entries that could be useless if we fail the last steps of authentication? One spot would be to delay the creation of the new entry at the end of pgstat_bestart(), where we know that we are done with authentication and that the backend is ready to report back to the client connected to it. It is true that some subsystems could produce stats as of the=20 early transactions they generate, which is why pgstat_initialize() is done that early in BaseInit(), but that's not really relevant for this case? I'm still feeling a bit uneasy about the drop done in pgstat_shutdown_hook(); it would be nice to make sure that this happens in a path that would run just after we're done with the creation of the entry to limit windows where we have an entry but no way to drop it, or vice-versa, so as the shutdown assertions would never trigger. Perhaps there's an argument for an entirely separate callback that would run before pgstat is plugged off, like a new before_shmem_exit() callback registered after the entry is created? -- Michael --2JGdTg12ZKrKP4HO Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmdf39gACgkQnvQgOdby QH0oERAAoJoxg6o6o7I6NKOPHxLxKFhaczcfiBRzw1SSdF20k9QTcK26yf4skpQQ KiSg5K4/kZHTWTBgGoAH/lnRqG82vuNM3VeIM8/5naKEqIjaNx1GMKot74AWiRaZ xBbfozNoKhkowRQij+VhBYFqI4eDs7U2E2iZlcoC7RvHSr/PktVgYXSMJcPyjb4X tps+AyA6u4g6B/D/JYMNOsBFvUC6AHbeUEgz7HW2vEvIgWoU4is32Rdn9RnVeAnV NUtDjIuH9NiRjUTZTuRBZFhAV6bU+jjkzuy/OwAjZBcpzDTC1obTkLncxf/0N/p/ oi8ip8EgAAbmUwacw/FIoMI+SnTG1s+hRfWV3BHhm4zuU8MPWHwTkVHtJsRjKbAB +JAc2perULqfI1NiQ49i9P8HHRGvmYMClxDFAbwSNfgAqBCK/zTw57oYbOONA30h Ziy1BbKBtD7hEw9Cq16kPaun8RlLCm5bVKvHIcH59G710DfvCadbM6i7IZ1xCJUO d+XQhntACokvgtZPfh1fvDwu2IrEFL2WxwbjHd8bY3GBhhwSVT4Xm6Y2xxSiV8+1 EzWcgQ/Ppws4XRLPlHVqW2fG83idXkgdMYugtXZhp3WnXT4GEypD2D2Emlhxo7YV /uSTS+q4VuqU/C+pYsQalGa9Z42kSR2fj3+QjFz5oCW/XazSIzo= =CNiT -----END PGP SIGNATURE----- --2JGdTg12ZKrKP4HO--