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.96) (envelope-from ) id 1vIbCs-006uqF-2h for pgsql-hackers@arkaria.postgresql.org; Mon, 10 Nov 2025 23:21:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vIbCq-0036I0-1r for pgsql-hackers@arkaria.postgresql.org; Mon, 10 Nov 2025 23:21:52 +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.96) (envelope-from ) id 1vIbCp-0036Hq-2Q for pgsql-hackers@lists.postgresql.org; Mon, 10 Nov 2025 23:21:52 +0000 Received: from fhigh-b1-smtp.messagingengine.com ([202.12.124.152]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vIbCn-0073vQ-03 for pgsql-hackers@lists.postgresql.org; Mon, 10 Nov 2025 23:21:51 +0000 Received: from phl-compute-02.internal (phl-compute-02.internal [10.202.2.42]) by mailfhigh.stl.internal (Postfix) with ESMTP id C72CC7A0104; Mon, 10 Nov 2025 18:21:45 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-02.internal (MEProxy); Mon, 10 Nov 2025 18:21:45 -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=fm3; t=1762816905; x=1762903305; bh=E5/znHUXRx hALANMrKqbweQfvrjXyK1WkLbaY+oqH00=; b=T1mXzWdhT8rlbv5nnoKe+qHfpW iYotdRYZQkI5EBh/rboDsMF8o350KL/qUU/gtQpWmRnebq4q9k8dSl6cBBFiQnue GapSsYWxoTOSWRDNAjnOyRXCWwkyya5VUfFByjN8JSY8FXuy0hzCANpMc0E6filu c2nEj0O4ljxtIlJ+GNi3PqDBkLHPICJ6d5mFv4FgPRyZ1HD+j3nyIv8EhC79JJG8 O3SjQ2WO1B8QAVeoqJpdtqhmi2yKr3omAeThTug3e3kqam83Mhk8O0aOkQVChcM7 tHq0rWZ5/EA6o2F9k6TTwX8FI/BuwN4yU3ztF8J8tAkpDPmQEoYv4Eezgqvw== 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=fm3; t= 1762816905; x=1762903305; bh=E5/znHUXRxhALANMrKqbweQfvrjXyK1WkLb aY+oqH00=; b=jbeQN5oY2dcBbJWcNC2/OAHiQgLmKYjeF2jUEOQxdC7rsgGVxA3 Owv3c0csLhiOzQ5vYdLpcEv7Sj4+jTIum3dNnvvkdBiKYQ2nKXAjKXh3PBM/eve2 J7aJTIMmOsvwImV24xbpqsopgY5K8mbNuxeo+f4cWqL5D4HnMtVqodDBWzpMsadT 94dDKUS9RkNVjzX3tCUJ5Wt9q78rEGsXDDppTy+edsjJxVGDnsyNhvlfQsIbTbmg akLtpYXOD2Bb3wIU+kxtPTbL0aUDM8KCkIQIrv1yCw1ep+kv9m3Xj33bW9xOdWnJ btPxmKaY+HzwHfBidJa18kuhIC5GbEWMNYw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggdduleeliedvucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnegfrh hlucfvnfffucdljedtmdenucfjughrpeffhffvvefukfhfgggtuggjsehgtderredttddv necuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruceomhhitghhrggvlhesphgrqh huihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepteelieefudffhffhtdetleeggeeg fffhkeeuveetiefgudduvedutefggeeivdejnecuvehluhhsthgvrhfuihiivgeptdenuc frrghrrghmpehmrghilhhfrhhomhepmhhitghhrggvlhesphgrqhhuihgvrhdrgiihiidp nhgspghrtghpthhtohepvddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepshgrmh himhhsvghihhesghhmrghilhdrtghomhdprhgtphhtthhopehpghhsqhhlqdhhrggtkhgv rhhssehlihhsthhsrdhpohhsthhgrhgvshhqlhdrohhrgh X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 10 Nov 2025 18:21:43 -0500 (EST) Date: Tue, 11 Nov 2025 08:21:26 +0900 From: Michael Paquier To: Sami Imseih Cc: PostgreSQL Hackers Subject: Re: [Proposal] Adding callback support for custom statistics kinds Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="oz2pWaY3uOOMEQ1d" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --oz2pWaY3uOOMEQ1d Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Nov 10, 2025 at 01:56:23PM -0600, Sami Imseih wrote: > I started reworking the patch, but then I realized that I don't like this > approach of using the same callback to support serializing NameData and > serializing extra data. In the existing "to_serialized_name" callback > , NameData is serialized instead of the hash key, meaning that the > "from_serialized_name" must be called before we create an entry. The > callback translates the NameData to an objid as is the case with replication > slots, and the key is then used to create the entry. Thanks for looking at that. > However, in the case of serializing extra data, we want to have already > created the entry by the time we call the callback. For example populating > non-key fields of an entry with a dsa_pointer after reading some serialized > data into dsa. > > If we do want to support a single callback, we would need extra metadata in > the Kind registration to let the extension tell us what the callback is used > for and to either trigger the callback before or after entry creation. I am > not very thrilled about doing something like this, as I see 2 very different > use-cases here. Ah, I see your point. By keeping two callbacks, one to translate a key to/from a different field (NameData currently, but it could be something else with a different size), we would for example be able to keep very simple the checks for duplicated entries when reading the file. Agreed that it would be good to keep the key lookups as stable as we can. So, what you are suggested is a second callback once we have called read_chunk() and write_chunk() for a PGSTAT_FILE_ENTRY_HASH or a PGSTAT_FILE_ENTRY_NAME and let a stats kind write in the main file and/or one or more extra files the data they want? I'd be fine with that, yes, and that should work with the PGSS case in mind. -- Michael --oz2pWaY3uOOMEQ1d Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmkSc3YACgkQnvQgOdby QH3F0BAAlYGmG+m7kbkBC/swWnMVRiyQ0S91MJVnN9oLabFcIOAd4TIDMqhLmcB9 Wq/26yeZU08AuCcDiGb/dkCgJfe09oG2udPGyW8S87fQN/KfAtQekNSqtl+ykD49 4Hf2vxF9nHjYjh6t1POMCczfsKl44jpP4wWp+z2BLbRbhuG+rS0V6Awq/mwIwahQ yX1W8WffMcWUdEuLFEHSpgRlZO4FRB02dy14rTRDTFSiocyCMuF5e2YPecDfvEY2 A+12eG1U3I4uw6wVw75S17QJjU18DIYtsC+3T2lGBK4y0NT1wQIjF9eRGcJfBrV3 vaVFGLZm55afQBPnLET0GWWIveWQFYaLjWlh5fwh9JV8PVyN/auMz4Z8n+PoeUjF MBK8Lu1CDp8WzrUhWZkoyduDjZnP40KMW0daOf5X2rhqfNQ70aZqxYWKNIY5kLgL jcK5wAe/1uPnaHFLI+GKWaKK7wFz/yqxbupmYRpGSezxuBBYcYBbZ9yCxJmgyfRr HY+Zz/NVjlniwDHfoE5QZvXBxCxhRJa4Ls1QBLNJEOfpE+8EAFLnRC0QgC/5aFTS tY/9yD9/woi3R/N0xsRdyu+7DA8Xnmvb7b0THohp87n69P3ZaPLBISgTiAUA8oIH AeXP1BafXmZC90u9uRSBJGNQ+ryngq/vxel23V0AZC3Fesy+n48= =NhTD -----END PGP SIGNATURE----- --oz2pWaY3uOOMEQ1d--