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 1vVlZZ-007OIO-1c for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Dec 2025 07:03:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vVlZX-00AmYS-0I for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Dec 2025 07:03:43 +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.96) (envelope-from ) id 1vVlZW-00AmYI-0V for pgsql-hackers@lists.postgresql.org; Wed, 17 Dec 2025 07:03:43 +0000 Received: from fout-a1-smtp.messagingengine.com ([103.168.172.144]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vVlZV-0016SY-06 for pgsql-hackers@lists.postgresql.org; Wed, 17 Dec 2025 07:03:41 +0000 Received: from phl-compute-01.internal (phl-compute-01.internal [10.202.2.41]) by mailfout.phl.internal (Postfix) with ESMTP id 5B0F8EC00BF; Wed, 17 Dec 2025 02:03:39 -0500 (EST) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-01.internal (MEProxy); Wed, 17 Dec 2025 02:03:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eisentraut.org; h=cc:cc:content-transfer-encoding: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=1765955019; x=1766041419; bh=Arz1gWB7NN9dOpQTNyFl8El6NCSRJ0Gh Tx7amBJT3UM=; b=b4KxMUrK5DnJXZzjwGW5WgFMRoMRpHHM6/1DAK6FqHY2SN8C 4XbggtC0PfPc/GSTDanLoX63VSxe8GhcVwG1X25DJlhvvuMPO8Rzo8P9JVwsd2FC OZhW5Mst0wpOqV4T+Y9+XXBfmC1PzrvyHaBDTiNOOtIR56YUNhr7/uHJirZ1xB6+ VXA50UJG0U69aY+RwXoCZlrTMfYnVkdDp5YdX96mmPgSKmeelhz+CWXR2EpRzVvH HCsafu+uUHRciFMAewsYyxfwNBsd49XvV1DO+jNifF6Y6Nuaw80+9E5Uv1BaH1Lz S4GG6ZMq7cTf6GraAQPKfm7MYvykAGrpngy+mQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :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=1765955019; x= 1766041419; bh=Arz1gWB7NN9dOpQTNyFl8El6NCSRJ0GhTx7amBJT3UM=; b=u uamMeIR2O9ShpwOIv1x/NBl8eAqPyTUbhFUOEsW0cMgE3ccZ9AMmF20x7BY8fsUG 9OEGMDT0Es34h4wpoONVEVg4BvBqOIL5xcZIFbBLuYvJTi8ORs2Intn03FyDIXal wZM74/vEcocGA541hsFsLYxQH+dtm/THoOb6acoYZJgP3XIABsIZe7vzHY6k9pV1 xEXDWPkJ+2bBgXrnC29s+o37brxeUL3Wx5flq896PRRLSxabuYn9zAV2hjQv9H9E S6mqF2p3FVAdPH3Ar5SPsvChKeleAm4wxZB1QpM1L3aMcrctj/uVGsAMbcALc9gp U+mVhtG6tMIcJ/jt8Z90Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgdegudeltdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug hrpefkffggfgfuvfevfhfhjggtgfesthekredttddvjeenucfhrhhomheprfgvthgvrhcu gfhishgvnhhtrhgruhhtuceophgvthgvrhesvghishgvnhhtrhgruhhtrdhorhhgqeenuc ggtffrrghtthgvrhhnpeejhfevhedttefgfffhhfeffefggffhffelgfeiueeukeehvdeh vdefheffvdefueenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfh hrohhmpehpvghtvghrsegvihhsvghnthhrrghuthdrohhrghdpnhgspghrtghpthhtohep gedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepshgrmhhimhhsvghihhesghhmrg hilhdrtghomhdprhgtphhtthhopehmihgthhgrvghlsehprghquhhivghrrdighiiipdhr tghpthhtoheplhhirdgvvhgrnhdrtghhrghosehgmhgrihhlrdgtohhmpdhrtghpthhtoh epphhgshhqlhdqhhgrtghkvghrsheslhhishhtshdrphhoshhtghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: ie0a040ee:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 17 Dec 2025 02:03:37 -0500 (EST) Message-ID: Date: Wed, 17 Dec 2025 08:03:36 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [Proposal] Adding callback support for custom statistics kinds To: Sami Imseih , Michael Paquier Cc: Chao Li , PostgreSQL Hackers References: <9252DA7C-C611-4A93-A484-E6CD42557C15@gmail.com> <4E61FDC4-CFBB-4116-980F-75ADD245A1F6@gmail.com> Content-Language: en-US From: Peter Eisentraut In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 13.12.25 01:41, Sami Imseih wrote: > Thanks for the updates! > >> - Less fwrite() and fread(), more read_chunk() and write_chunk(). We >> are exposing these APIs, let's use them. > > oops. That totally slipped my mind :( sorry about that. > >> - The callbacks are renamed, to be more generic: "finish" for the >> end-of-operation actions and to/from_serialized_data. > > At first I wasn’t a fan of the name “finish” for the callback. > I was thinking of calling it “finish_auxiliary”. But, we’re not > forcing callbacks to be used together, and there could perhaps > be cases where “finish" can be used on its own, so this is fine by me. > > I made some changes as well, in v8: > > 1/ looks like b4cbc106a6ce snuck into v7. I fixed that. > > 2/ After looking this over, I realized that “extra” and “auxiliary” > were being used interchangeably. To avoid confusion, I replaced all > instances of “extra” with “auxiliary" in both the comments and > macros, i.e. TEST_CUSTOM_AUX_DATA_DESC The function test_custom_stats_var_from_serialized_data() takes an argument of type const PgStatShared_Common *header which is then later cast entry = (PgStatShared_CustomVarEntry *) header; where entry is defined as PgStatShared_CustomVarEntry *entry; So you are losing the const qualification here. But fixing that by adding the const qualification to entry would not work because what entry points to is later modified: entry->description = InvalidDsaPointer; So the header argument of the function should not be const qualified. But the signature of that function is apparently determined by this new callbacks API, so it cannot be changed in isolation. So it seems to me that either the callbacks API needs some adjustments, or this particular implementation of the callback function is incorrect.