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 1qaRSF-009FP3-NJ for pgsql-hackers@arkaria.postgresql.org; Mon, 28 Aug 2023 01:54:12 +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 1qaRSC-005hBr-Dz for pgsql-hackers@arkaria.postgresql.org; Mon, 28 Aug 2023 01:54:08 +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 1qaRSA-005hBf-Op for pgsql-hackers@lists.postgresql.org; Mon, 28 Aug 2023 01:54:07 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qaRS6-001R7e-OK for pgsql-hackers@postgresql.org; Mon, 28 Aug 2023 01:54:05 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 7C2B95C0050; Sun, 27 Aug 2023 21:54:00 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Sun, 27 Aug 2023 21:54:00 -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:sender :subject:subject:to:to; s=fm1; t=1693187640; x=1693274040; bh=GA njvSB4rqJY/EkUseT6M6xkw0PHk3pS2G8h4xNWm0c=; b=Ki9mna4cu5Ub/zs8OM lKKKkjyuWCtP6yV0SDNW/GNg20n1XmRa7wS2g6wHad1BSB247cfoB8Y3hKmyjEOC +kn8GZQf9LR4/HA5j7R33OV6y6OrFIPxdkt9uJIfa0i4VVGI1p2VIT3yV4B2ny+U Xw2FtjThXnQ1NJcGCYilvbIn5SUIYgCk7QKYEDzYdkSt/arikQKnGlfHS/7fvse2 ZW6bfA8odVZbDdJDE8HiCtWxC1bUZdccESPJrd/Ceeo+mJ0kY8TAmbkl0Ssm4dUC ODmndtWqC/LlQfFKFEZdP1yWACObm5p/L2DRABgUz5iR01VWLAIsFsY6U8KZQL4o eQBA== 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:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; t=1693187640; x=1693274040; bh=GAnjvSB4rqJY/ EkUseT6M6xkw0PHk3pS2G8h4xNWm0c=; b=skx9nuOgdRX8bS1svArIg0ukZSlEa xWcwJEAl/IJKmj0DuoTC3rgdfY1x1dU0gSfwHp/aEPua8DYvNz48fauMP4NfePLq rZVd6TR9rFPZ+pM4hrJlpUsdOxstx7n59AyIVx+M2UKB5qDFxSQTx107dUbeAmLl BpsvEpBm8MOXiwLBzeigQrKQucXaPVseYsERR15pNjU4RHYb31PEMzO7e9/qjOw2 ZDPq5b0uj7EWa35DIUQwn30mvqY9a3Ua0glzApmcGFYTp44Z26sjDHOs052UyG29 j5gSwxgYeye5ZCfQkS165NJiOLrCkwoMDlCGY9PGUk50rcYiVoV/4Tixg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrudeffedgheduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne gfrhhlucfvnfffucdljedtmdenucfjughrpeffhffvvefukfhfgggtuggjsehgtderredt tddvnecuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruceomhhitghhrggvlhesph grqhhuihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepteelieefudffhffhtdetleeg geegfffhkeeuveetiefgudduvedutefggeeivdejnecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomhepmhhitghhrggvlhesphgrqhhuihgvrhdrgiih ii X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 27 Aug 2023 21:53:57 -0400 (EDT) Date: Mon, 28 Aug 2023 10:53:52 +0900 From: Michael Paquier To: "Imseih (AWS), Sami" Cc: Nathan Bossart , Ian Lawrence Barwick , pgsql-hackers , "robertmhaas@gmail.com" Subject: Re: pg_stat_get_backend_subxact() and backend IDs? Message-ID: References: <20230824023206.GA1128857@nathanxps13.lan> <20230824025140.GB1128857@nathanxps13.lan> <20230824161913.GA1394441@nathanxps13.lan> <20230825153251.GA1593219@nathanxps13> <20230825192949.GA1917227@nathanxps13> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="OKYliYMtQhPGQaBG" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --OKYliYMtQhPGQaBG Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Aug 25, 2023 at 10:56:14PM +0000, Imseih (AWS), Sami wrote: > > Here is a new version of the patch that avoids changing the names of the > > existing functions. I'm not thrilled about the name > > (pgstat_fetch_stat_local_beentry_by_backend_id), so I am open to > > suggestions. In any case, I'd like to rename all three of the> > > pgstat_fetch_stat_* functions in v17. >=20 > Thanks for the updated patch. >=20 > I reviewed/tested the latest version and I don't have any more comments. FWIW, I find the new routine introduced by this patch rather confusing. pgstat_fetch_stat_local_beentry() and pgstat_fetch_stat_local_beentry_by_backend_id() use the same=20 argument name for a BackendId or an int. This is not entirely the fault of this patch as pg_stat_get_backend_subxact() itself is confused about "beid" being a uint32 or a BackendId. However, I think that this makes much harder to figure out that pgstat_fetch_stat_local_beentry() is only here because it is cheaper=20 to do sequential scan of all the local beentries rather than a bsearch() for all its callers, while pgstat_fetch_stat_local_beentry_by_backend_id() is here because we want to retrieve the local beentry matching with the *backend ID* with the binary search(). I understand that this is not a fantastic naming, but renaming pgstat_fetch_stat_local_beentry() to something like pgstat_fetch_stat_local_beentry_by_{index|position}_id() would make the difference much easier to grasp, and we should avoid the use of "beid" when we refer to the *position/index ID* in localBackendStatusTable, because it is not a BackendId at all, just a position in the local array. -- Michael --OKYliYMtQhPGQaBG Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmTr/jAACgkQnvQgOdby QH2H7A//X9EPT/T/mxV+VWC6iWCc62MNY4CKCgqqOGr6FUAUcWrXQpBc0YW8Frva sNaGg/TlSlKbnHKkUTAufHw2dOiO014HCO0yvIL3osOXIn3dE29zBT2I7cqFAzMA H8Dkv2q/+mdJPq2WVB0jbe+FL08OFSWxj7xCTmV3oDkWBKNcPiPkY55I44HIeF76 sejO3HUHLWVAKNiq8OTStS731WpXGtnMm6SVYJViDVtBMSS6wnuVssscbMjia6MA PMUclp4QybNaKTzOIDVSqlTWgSj20x2w8WwJfkz8nMz0cMm3DJSNMRoJ8/t8/BnC MTyFAChhOoMh4DxTEnktCkwzjCZvcvQVNXpUu6U/LG8L/eFnS49R8gcgM6Hd7TS4 LNUnrJMxzeb60qg1x+JvDUy695Js3sB1zGxeh+wHJ7ixXYVLvBmn5OwuvIEDoK9c d1rh7YqBsBIrZvmqnqTDUrd4BYo3sI8p8e12CerAStj+NzyYLF6Mzn2u3ZA4/pgZ tcXP3E2c/8ADWiv3I+TacsdKex1IU2W8WO7qntJ/2jo2hH/RSVJ0M1yBopiPElnZ XxuqhG9nNEaCC9XbzN0/wo4A3+7b/QIDWyoqWQ+I0PH0DqmQmlOCpF7TcF3+yMY6 WF7jpzcqJ/iw2fcwrd32f8BSksjcOWxoFOhWVVTPw0mWJppOCVA= =chn0 -----END PGP SIGNATURE----- --OKYliYMtQhPGQaBG--