public inbox for [email protected]  
help / color / mirror / Atom feed
From: Chao Li <[email protected]>
To: Sami Imseih <[email protected]>
Cc: Michael Paquier <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Subject: Re: [Proposal] Adding callback support for custom statistics kinds
Date: Tue, 9 Dec 2025 11:38:53 +0800
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAA5RZ0tST1=piXSQwRn2y+YB-VwS+Dtr0Wk27Dw7ED+Xp6qSXQ@mail.gmail.com>
References: <CAA5RZ0tvDvHYYLnu-T0DRK0xv1qv2_EK1yHjth5uAqDWz_GvfA@mail.gmail.com>
	<CAA5RZ0thcqk_r_SCB3TdXP9hVV5mG_29yc9GaGr4ujPQmcLDEQ@mail.gmail.com>
	<[email protected]>
	<CAA5RZ0ufds2r3H7QUro_yJDrnUmsQ4ocufqgcsRGoZvxQKeMrA@mail.gmail.com>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<CAA5RZ0sJgO6GAwgFxmzg9MVP=rM7Us8KKcWpuqxe-f5qxmpE0g@mail.gmail.com>
	<[email protected]>
	<CAA5RZ0sG2RUKg=OLY+6-e4q=X9rsLfK3pKn03d=RZQppEDR=Bg@mail.gmail.com>
	<[email protected]>
	<CAA5RZ0tST1=piXSQwRn2y+YB-VwS+Dtr0Wk27Dw7ED+Xp6qSXQ@mail.gmail.com>



> On Dec 9, 2025, at 03:09, Sami Imseih <[email protected]> wrote:
> 
>> 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.
> 
> Thanks for getting these committed!
> 
> I rebased the custom callbacks patch in v5.
> 
> One very minor thing from the earlier commits that I corrected here is
> the test for entry 2 after a clean restart.
> 
> -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 = $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");
> +
> 
> --
> Sami Imseih
> Amazon Web Services (AWS)
> <v5-0001-Allow-cumulative-statistics-to-serialize-auxiliar.patch>

```
+					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/









view thread (47+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected]
  Subject: Re: [Proposal] Adding callback support for custom statistics kinds
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox