Re: add validations for required callbacks during pgstat_register_kind() - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: add validations for required callbacks during pgstat_register_kind()
Date
Msg-id aksK5z3jYIdImtoD@paquier.xyz
Whole thread
In response to Re: add validations for required callbacks during pgstat_register_kind()  (Sami Imseih <samimseih@gmail.com>)
List pgsql-hackers
On Fri, Jul 03, 2026 at 11:04:56AM -0500, Sami Imseih wrote:
> v2-0002 also makes the errmsg consistent and includes kind names
> (except for when a name is not provided)
> and kind IDs across all the messages.

Thanks.  Merged 0001 and 0002 together, tweaked two small things
(s_p_l replaced by a %s, and an underscore removed), and applied the
result on HEAD.  Consistency is nice.

> hmm, I think it's better to have a clear assertion log ( when built
> with asserts ),
> than a segfault. Also, it's self-documenting. It is also consistent with
> snapshot_cb. I think we should keep it, but I separated that into a v2-0003,
> Perhaps you will change your mind.

The locations of snapshot_cb are a bit smarter than this proposal:
- The assertion at the beginning of snapshot_fixed() is
unconditionally taken and makes sure that the callback is set.
- The assertion in pgstat_build_snapshot() make sure that no callback
is set if we have a non-fixed kind.
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Noah Misch
Date:
Subject: wait_event_type for WAIT FOR LSN
Next
From: Michael Paquier
Date:
Subject: Re: [PATCH] Warn when io_min_workers exceeds io_max_workers