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 1vSoZg-006BnH-0l for pgsql-hackers@arkaria.postgresql.org; Tue, 09 Dec 2025 03:39:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vSoZe-002XO8-1E for pgsql-hackers@arkaria.postgresql.org; Tue, 09 Dec 2025 03:39:38 +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 1vSoZe-002XO0-0G for pgsql-hackers@lists.postgresql.org; Tue, 09 Dec 2025 03:39:38 +0000 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vSoZb-003xzv-34 for pgsql-hackers@lists.postgresql.org; Tue, 09 Dec 2025 03:39:38 +0000 Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-7bb710d1d1dso8178058b3a.1 for ; Mon, 08 Dec 2025 19:39:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1765251573; x=1765856373; darn=lists.postgresql.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=/dlAGZJKDEtYRAE9siqGXr9pSTIOy/m+EQPlkqi8DqU=; b=eEzcV95ERSFF5ITUciEHUkC/BMCFJE23M+AF00xX8jrsujSm9OFqOu9K1aan4EALSu +iXmdZbOZEyXE2ojjoTzRBfB8s2jjI4ZWTKjjxcktfJXpZnGg3ut4Qv3wIyeGUAKAVyw H1gN03jarJeFvL2zU9h+SNYf3fwDAk/fLJOrDeAdT5nuRsn56BOfljbcJ7oOhMGPFZhS 2cLKq6viKgWGQSucBuq3FrDK65XZa3UdjKQBzfqKzH9Ez9Ip7PXVKWhHU8DgiWRslDJO y2bXpY64S8EYEoKOKMHJv8ARvGlkogzVRI+erQFaazGK6qOEPPMYazLPieglBz3SoMOO XwAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765251573; x=1765856373; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=/dlAGZJKDEtYRAE9siqGXr9pSTIOy/m+EQPlkqi8DqU=; b=uHJQFGs87mS1iZWJFZ+4b5ZqIF79IPN2gnzu4smi8zEU2gxS6lTF8dWJhRvKJQny+p qafIm8ehhUB/3EC3irfMnZcrvSvXT5j1gTO1lXq9QHfaytgoLwteN+zPYuq+2jQmiofP 8rtAwK66rDb6X2AVWWU2j0sO4m0y8mszXYdgExWsoCHJAd5HT2NJ69aXZ9CH30B45iFW DULsb0CklYDe/pTG5DUXjL3K7bu6h39VH0klHK7wLk/NzI7UbWkS1+zThldKstvxAp2r imTC3ZtQM/7v2zzNO29nh4dd2E4lJ57J8xjJdegc11xoYg+pnqUS1JIbL0MnK52JfmDP oTcA== X-Forwarded-Encrypted: i=1; AJvYcCWUE5n1y0rARwE8mYutqZy2JsMMKaq9EFD+5FwrlAbMVNLX8bCoFL1FI/Cfs99g3IqL+SFmS3sFtBfBuGiy@lists.postgresql.org X-Gm-Message-State: AOJu0Yz6/Y3ZiappPLG77bggFYnwA0PzJrshk55gHzUvaqs9x1JLENyP aVgZtKMKzyD7p15DEO/6V1Dak7lYoAFr/gtlKONKxmaiXv/mlHp1MEc5Zsbv8sZwTal5bw== X-Gm-Gg: ASbGncvI8mp7URvk7Xsm0XmHPP3z54VuTjtjZtyWA1iOSYgY2mZV/M2wZ9fs3rsHVvX 9TAAO8zGzyiN7zTpGzgXyizF4HTCkfwu720dw2SMnsu7OlTR/zZhguLA/PAaIfL8EnDKpjkkyNC 2DLCQFwiXEvcRGxMIk6MFQJExjIXujD+84lIdVkko+PKEDIvAdKAhqBB56POA4AYD6royXIXe8A Hqh7Fy8+B6FTvMNJeJZaaUdSombrKfn1ugG6tJYCUR54ZEIOCFbenK7iSLKDk/sEAlB2K4fYLEB vdCT0hJ0bO9s9W5G5BE2oRrrvlu+rjz7poQnztH1PusROSbfJJMduaAik9Tvw5OSWd4IZsMprOL HdepsJDfaa1J+ibMn/kCf3xlb4iUjqjo/wFhoGoQgfdGHeyjsnTozS1I259kE5MzDyHR1WKuqE1 hvSGJyp+zkweH1xKb8ylo= X-Google-Smtp-Source: AGHT+IFS0GGqSb8SYx2QsU52V7DUrakrBziFbnyLe5Y1rzMU55LbzYQ6Wyq633VWkZ9VxkQhx5vhkQ== X-Received: by 2002:a05:6a21:9999:b0:34e:a801:8166 with SMTP id adf61e73a8af0-36617e8d198mr10471286637.32.1765251573489; Mon, 08 Dec 2025 19:39:33 -0800 (PST) Received: from smtpclient.apple ([45.32.121.103]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-bf6a32dff0fsm13469776a12.32.2025.12.08.19.39.31 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 Dec 2025 19:39:32 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.700.81\)) Subject: Re: [Proposal] Adding callback support for custom statistics kinds From: Chao Li In-Reply-To: Date: Tue, 9 Dec 2025 11:38:53 +0800 Cc: Michael Paquier , PostgreSQL Hackers Content-Transfer-Encoding: quoted-printable Message-Id: References: <4FEEC2B8-D9CF-4BD0-AA7E-44CE3E27ADD8@gmail.com> <5EC13E39-B41E-464A-B382-0ACEB18A15BB@gmail.com> To: Sami Imseih X-Mailer: Apple Mail (2.3826.700.81) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On Dec 9, 2025, at 03:09, Sami Imseih wrote: >=20 >> Yes, thanks. Structurally, this is better and more flexible than = what >> we had originally, and I have noticed that you have copied the >> original files while adding more comments and renaming a bit things: >> the structure of the functions was exactly the same. Anyway, I have >> worked on that for a good portion of the day, splitting the module >> drop and the new module into two commits, and applied the result = after >> tweaking quite a few things in terms of names and comments (no >> pgstat_*, a bit more "Var" and "Fixed", etc.), applying a much more >> consistent set of names across the board for the functions and the >> structures. This cleanup part is moved out of the way now, so that >> you ease the introduction of the next pieces you are proposing. >=20 > Thanks for getting these committed! >=20 > I rebased the custom callbacks patch in v5. >=20 > One very minor thing from the earlier commits that I corrected here is > the test for entry 2 after a clean restart. >=20 > -is($result, "entry1|2", "variable-sized stats persist after clean = restart"); > +is($result, "entry1|2|Test entry 1", "variable-sized stats persist > after clean restart"); > + > +$result =3D $node->safe_psql('postgres', q(select * from > test_custom_stats_var_report('entry2'))); > +is($result, "entry2|3|Test entry 2", "variable-sized stats persist > after clean restart"); > + >=20 > -- > Sami Imseih > Amazon Web Services (AWS) > ``` + if = (kind_info->from_serialized_extra_stats) + { + if = (!kind_info->from_serialized_extra_stats(&key, header, fpin)) + { + elog(WARNING, = "could not read extra stats for entry %u/%u/%" PRIu64, + = key.kind, key.dboid, key.objid); + goto error; + } + } ``` When deserialize failed, it goes to error. In the error clause, it calls = pgstat_reset_after_failure(), so do we want to give extensions a chance = to do some reset operations? If yes, then we can add a = reset_after_failure() callback. Best regards, -- Chao Li (Evan) HighGo Software Co., Ltd. https://www.highgo.com/