Re: [Proposal] Adding callback support for custom statistics kinds

From: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Sami Imseih <samimseih(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [Proposal] Adding callback support for custom statistics kinds
Date: 2025-12-09 05:23:56
Message-ID: BF27BA43-D94D-4DC6-BD91-95EEAD42AD0F@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On Dec 9, 2025, at 12:45, Michael Paquier <michael(at)paquier(dot)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.

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message tushar 2025-12-09 05:32:51 Re: pg_dump:qemu: uncaught target signal 7 (Bus error) - core dumped
Previous Message jian he 2025-12-09 05:21:51 add some errhint for regexp* functions.