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 1vRIJF-00Atbc-2u for pgsql-hackers@arkaria.postgresql.org; Thu, 04 Dec 2025 23:00:26 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vRIJE-005ci2-34 for pgsql-hackers@arkaria.postgresql.org; Thu, 04 Dec 2025 23:00:25 +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 1vRIJE-005chu-2A for pgsql-hackers@lists.postgresql.org; Thu, 04 Dec 2025 23:00:24 +0000 Received: from mail-ed1-x530.google.com ([2a00:1450:4864:20::530]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vRIJC-003BFO-1T for pgsql-hackers@lists.postgresql.org; Thu, 04 Dec 2025 23:00:24 +0000 Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-64198771a9bso2559478a12.2 for ; Thu, 04 Dec 2025 15:00:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1764889222; x=1765494022; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=dPf4COCNERNazfFwxP+oiBahq0wUFZp5Z9zDFmTgy/A=; b=O4NeJEseUCaajMEjGFS/ygJ7GOCnlcGa6+R8Xn6OHOrAx7AkfW5G+DOTBfmg7J9a05 iiWCtG/b4xPGWgtghwkAwwVh2+7FQe8b5oZ+vUICnwwJ26+y2L4aFnLwILkJjIgDnFX3 wIPPS4cV/jYWqRMUHTgQyBxAAlk0FBcN1icLxhVt9P3CMFkXEBYIIvVNYPX32vVTZMNw Y4D817r74dOoUaVv4FfnOZBlrEG917SeNn5I6AumuvpsZxcyTICE0VgVv+Evbf3xf0xz f20xRY1Lmswp96k3gfvxvaev1fjzserMFvlVoiW9fdD5vANg6pVprGjqb2X1wXU+WpOk vjGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764889222; x=1765494022; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=dPf4COCNERNazfFwxP+oiBahq0wUFZp5Z9zDFmTgy/A=; b=Kd7CXzW9LMTKaE6YJqsLu2d7YVbhAgmR/QXKMM1I9kNbFX70wo8zMzPOjKGdaVy4sn nPsmolvLIBorfBnNuiK/MkWfML+lWtV6RS9J3/O4WYYop1o+lZYrK0OpFCxn10eDcgMy 1E5+W83GQ01IfdXTF1AhCsh30wd5bo+QFjaO7mVXzZ2pPrR0gOPzSCDSTwhZ2Kdne83x r6s5w8mIACN1SGL9MBgOh78a7vHelfSx2EE8FshEKVf28BaJC8DPcuMYAUHxSs4U5KzZ 4gh/Odt5CKtylGq7JccvcjhlbhxwCkA4UYF/Pds1ZXPUcs6uYnyJVlgjsJPd0iRWBJy7 rYyA== X-Forwarded-Encrypted: i=1; AJvYcCWE/i10Agdre8uNdYFwJ/jvCBBLGE67cLMqCa4n5/OSsMFhCFXHVqgHMlqj6c763V2U30/+XJF2cyH65m/i@lists.postgresql.org X-Gm-Message-State: AOJu0Yz+5ojWoDGpwIoNYMgNmywy4AiShdn4fUgImCIVNXlUpWaWYrhv qyA5K1Qd8xYIqDDey5DbJ0OVs07q7n7bqeGIWWjZGy9+toAMHcPv/kArKlXsfqzPD80TdW0L4hj QbuY9pPKyzg36qXcbNzm5Er7JcM8suU8= X-Gm-Gg: ASbGncsr+5BQTpvH22k1lKXDjXXlk/lNZ/gSp5vxNyCTw1hYj7MR0MR0AGOVO3OH9uq LP8sUw6xbiQ1w+QjoDogz0+nQHmDFEzTMyBPZXH7wtE+PHgUkgBjlGtXgJYk0oTiUhIRLR00RZ3 FZdAVzFq8D3IYq+P/3CCGeqRL3X5oRHMyU8RONia+fkfFBGExX7/NtTf3+y/a54kRxdM7Ij+h9U m101GYusg9qZou+0K6EzV0bTuEElKK3xB3i31GTYy/aoIDfstJ9miLnphqzoCdLPkGMEiScMTYu DDwR X-Google-Smtp-Source: AGHT+IGLGU0JDcTKD42mOoriB1Xia1xfqc3xPQyYcI56SSEYr+anVSS/YasMTJ42+JLAmjrx0k4m33X7iu8ibLMl7j4= X-Received: by 2002:a05:6402:27d4:b0:647:99da:639c with SMTP id 4fb4d7f45d1cf-6479c3ed687mr7341124a12.6.1764889221618; Thu, 04 Dec 2025 15:00:21 -0800 (PST) MIME-Version: 1.0 References: <4FEEC2B8-D9CF-4BD0-AA7E-44CE3E27ADD8@gmail.com> <5EC13E39-B41E-464A-B382-0ACEB18A15BB@gmail.com> In-Reply-To: <5EC13E39-B41E-464A-B382-0ACEB18A15BB@gmail.com> From: Sami Imseih Date: Thu, 4 Dec 2025 17:00:10 -0600 X-Gm-Features: AWmQ_blgpTs_AeVZA2vzVb2NTOvz41YNaTL7zJWAr3DcAdXyJ_28v4Tz93xfAx4 Message-ID: Subject: Re: [Proposal] Adding callback support for custom statistics kinds To: Chao Li Cc: Michael Paquier , PostgreSQL Hackers Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > If we push down the responsibility into the extension code, then all extensions > that want to enjoy the callbacks have to handle the same complexities of dealing > with stat files, which sounds big duplicate efforts. Thanks for the input! Yes, this is a trade-off between putting responsibility on the extension vs core. The initial thought I had was exactly like yours, but it will be easier to get something pushed if we make the core changes as minimal as possible. If there are enough complaints in the future, this can be revisited. Particularly if there is a common patterns for file cleanup, this could be turned into a core utility. > That looks like a good direction to me. The only differences I can > see with the stats module in injection_points for variable-sized stats > is that this new module does not check pgstat_drop_entry() and > pgstat_fetch_entry() when working on a custom stats kind. If we had > SQL interfaces calling these two, we could just remove > injection_stats.c entirely, moving everything to this new test module. > I should have invented a new module from the start, perhaps, but well, > that was good enough to check the basic APIs when working on the > custom APIs. Removing this duplication would be my own business with > your module in the tree, no need for you to worry about that. That > would also remove the tweak you have used regarding the duplicated > kind ID. I plan on addressing the other comments. However, as discussed off-list, I do think moving the custom kind tests from injection points to the new test module is a prerequisite. I rather not have us push a new test module that is doing duplicate work as the injection stats tests. I worked on this refactoring today and plan to have a patch ready for review by tomorrow. -- Sami Imseih Amazon Web Services (AWS)