Re: [Proposal] Adding callback support for custom statistics kinds - Mailing list pgsql-hackers

From Chao Li
Subject Re: [Proposal] Adding callback support for custom statistics kinds
Date
Msg-id 9252DA7C-C611-4A93-A484-E6CD42557C15@gmail.com
Whole thread Raw
In response to Re: [Proposal] Adding callback support for custom statistics kinds  (Chao Li <li.evan.chao@gmail.com>)
Responses Re: [Proposal] Adding callback support for custom statistics kinds
List pgsql-hackers

> On Dec 9, 2025, at 13:23, Chao Li <li.evan.chao@gmail.com> wrote:
>
>
>
>> On Dec 9, 2025, at 12:45, Michael Paquier <michael@paquier.xyz> wrote:
>>
>> It seems to me that you are missing nothing here, and that Chao has
>> missed the fact that the end of pgstat_read_statsfile() does a "goto
>> done", meaning that we would take a round of
>
> No, I didn’t miss that part. But in the “done” clause:
>
> ```
> done:
> /* First, cleanup the main stats file, PGSTAT_STAT_PERMANENT_FILENAME */
> FreeFile(fpin);
>
> elog(DEBUG2, "removing permanent stats file \"%s\"", statfile);
> unlink(statfile);
>
> /* Let each stats kind run its cleanup callback, if it provides one */
> for (PgStat_Kind kind = PGSTAT_KIND_MIN; kind <= PGSTAT_KIND_MAX; kind++)
> {
> const PgStat_KindInfo *kind_info = pgstat_get_kind_info(kind);
>
> if (kind_info && kind_info->end_extra_stats)
> kind_info->end_extra_stats(STATS_READ);
> }
> ```
>
> end_extra_stats(STATS_READ) has no failure indication.
>

Sorry, I incidentally clicked “send” too quickly.

My point is that, there are many places jumping to “error”, then from “error” goto “done”, if an error didn’t happen
fromthe deserialize callback, how end_extra_stats() can know if failure happened and takes action accordingly? 

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/







pgsql-hackers by date:

Previous
From: Nico Williams
Date:
Subject: Re: [Patch] Add WHERE clause support to REFRESH MATERIALIZED VIEW
Next
From: Peter Smith
Date:
Subject: Re: [WIP]Vertical Clustered Index (columnar store extension) - take2