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 1qwG0u-00AeD6-GN for pgsql-hackers@arkaria.postgresql.org; Fri, 27 Oct 2023 06:08:09 +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 1qwG0s-00BY8k-1s for pgsql-hackers@arkaria.postgresql.org; Fri, 27 Oct 2023 06:08:06 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qwG0q-00BY8b-Jv for pgsql-hackers@lists.postgresql.org; Fri, 27 Oct 2023 06:08:05 +0000 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qwG0n-002Wdr-JS for pgsql-hackers@lists.postgresql.org; Fri, 27 Oct 2023 06:08:03 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id A64A45C01F2; Fri, 27 Oct 2023 02:08:00 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Fri, 27 Oct 2023 02:08: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=fm3; t=1698386880; x=1698473280; bh=X4 ob5SfWHR0NXyPU+amaUuICpd38nkdPpcuu74Jcyt8=; b=OOV05eUQLMrmWqRlTv B81ya9XmHxdlFS07utWGq9SKWVqndf5xve1e5/vdM20cpjuu+5l+HQ4PAMDVc75C 9kECpqXswB1pjztuPk7zanSYGwBf+lerrwsc9gsNTcfHEgrk6jPeLt6IcfPvJ+0w 75neGsw09hlEGUI3r9XSU9RIgysEBMPH138f3yplGsOu9FwZLeuTt/TknxaU72PI tTTpo3dxJjypU3lsPaPkK0lSInUG1t85F4lVkbK8NthcZLKIMcSjy/il8HRWcHDi vO0xJ6pHQFXyOfaCbE1GnWMeFVZlwII3ueuRJkH4BaxZzanI0qTtCXmQOz2oYK89 zjow== 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=fm3; t=1698386880; x=1698473280; bh=X4ob5SfWHR0NX yPU+amaUuICpd38nkdPpcuu74Jcyt8=; b=lwgvIdgPacCGceRiGELxdH2WO2gxG tBHkRki4PtXuxj3PtfbQfx8gU0OK26F26G2GwkmX+2ZCach9Ibwp5Txz7MqDwd9W BMJLMq5zEyFtL2tjF06JcV4eYmeSNJAyLA81rniAn5a5rcxawSCsLcNf/SdAJnSq xzXRBd1JCpQvcS1ipZS8DaDbmA5mX7nAFcvjD4TWkdeViw0go9vJavkxFWAPCoUt HUEftDq1zFLONbY82qvDKbve7Xe7rtDVZIuxxwC2brPcP7aMdo2Aiu+o7Q+f88wr 4wAvZUYxvewb+9lgbYdvAy5o5WujYMlyP4Dabh9Yz0NSkIa+EpnO+F8sQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrleefgddutdeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne gfrhhlucfvnfffucdljedtmdenucfjughrpeffhffvvefukfhfgggtuggjsehgtderredt tddvnecuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruceomhhitghhrggvlhesph grqhhuihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepteelieefudffhffhtdetleeg geegfffhkeeuveetiefgudduvedutefggeeivdejnecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomhepmhhitghhrggvlhesphgrqhhuihgvrhdrgiih ii X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 27 Oct 2023 02:07:58 -0400 (EDT) Date: Fri, 27 Oct 2023 15:07:55 +0900 From: Michael Paquier To: "Drouvot, Bertrand" Cc: Andres Freund , Kyotaro Horiguchi , pgsql-hackers@lists.postgresql.org Subject: Re: Reconcile stats in find_tabstat_entry() and get rid of PgStat_BackendFunctionEntry Message-ID: References: <20230216212121.uvav7xgdh2ysqjy5@awork3.anarazel.de> <621ed53c-4d9a-8f77-ab8c-20235f2d95a1@gmail.com> <20230325030044.nhfas3nommsmwl6q@awork3.anarazel.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="cmv04uMaPHrDGBnI" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --cmv04uMaPHrDGBnI Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Thu, Oct 26, 2023 at 10:04:25AM +0200, Drouvot, Bertrand wrote: > By "used in an unexpected way in the future", what do you mean exactly? Do you mean > the caller forgetting it is working on a copy and then could work with > "stale" counters? (Be careful about the code indentation.) The part that I found disturbing is here: + tabentry = (PgStat_TableStatus *) entry_ref->pending; + tablestatus = palloc(sizeof(PgStat_TableStatus)); + *tablestatus = *tabentry; This causes tablestatus->trans to point to the same location as tabentry->trans, but wouldn't it be better to set tablestatus->trans to NULL instead for the copy returned to the caller? -- Michael --cmv04uMaPHrDGBnI Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmU7U7sACgkQnvQgOdby QH3ONw//c8LoMvJI0E0WToZySl4NSCsR5hdQxDV5F90jRf4OKAwLzs5lglLKgPTF rjaod311fldigsMbrY8V8KDVQsVWBRyAoKKZQWD2Fr8yMtP8lh4TFuHiOj4kb3zL XH90nu3Phvm6KhJSQEKJFf3/edpWVY2mqa/+Sdxj3LV1/5jWUg1rdweEwmhuIRpk yt7EszU5h9Y3PHrlonFXM9iKLLSgAGMlRX6igyl9Xv+iAq1WrZu0TOzpgQB2YDvV zAbH2x+ybrJhO8qJty/psvwm7GBX7Pb5XNM5xhCGAfEAxHZeWgKVcisdZZBVCdB6 TWA4Po6Fodln+1Y9JeYiboo0ZCKkv5TPapuRIEWqarrMA4UhAhHiR53riZ5n2e3G rvGVY+ldnZXW5AIc/CitvpwUV7ttx6gKdTBmQ7jzpuKG6pKMa7r3j4Z7MqqGpgq5 rdwDWhK4Rw91Ww0TOmxNjwmogC/O8a/U4CBxoHhXaB9RPqbHJc8zn/GyGEuz877v Fpn6fooupJBWu057/VNhCRSEUzx5QMzxdqcUk2zEeMdjQWNbZKn7P68YJxDRGKkb 1uJhbaIcOVoLosLmXfqbA58NhYuwm1r5feE0s5sIloOwlzy+SDkdKlDaHylmgwky 50T0qEl1whwW0moeyrnKIeC9UlgpBeZMZlbIRUEk13UHPfgtp4g= =7Ruq -----END PGP SIGNATURE----- --cmv04uMaPHrDGBnI--