Re: Add pg_get_injection_points() for information of injection points

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: Rahila Syed <rahilasyed90@gmail.com>
Cc: "Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>, Postgres hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-04-22T04:14:59Z
Lists: pgsql-hackers

Attachments

On Tue, Apr 15, 2025 at 04:37:51PM +0530, Rahila Syed wrote:
> The function actually retrieves an array not a list, so the comment and
> the function name may be misleading.
> This function not only retrieves an array of injection points but also
> the number of injection points. Would it be more efficient to define a
> single
> struct that includes both the array of injection points and the number of
> points?
> This way, both values can be returned from the function.

Right, I was wondering a bit what to do here.  And I've come down to
the conclusion to just make this API return a List.

> Would it be useful to put the logic of the above function under #define
> USE_INJECTION_POINT.  This approach would make it possible to
> distinguish between cases where no injection points are attached and
> instances where the build does not support injection points.

For this one, I've found that InjectionPointList() was the incorrect
bit: we can make it issue an elog(ERROR) if !USE_INJECTION_POINTS.
This way, none of its callers will be confused between the case of a
NIL List meaning either !USE_INJECTION_POINTS or that there are no
points attached if the build uses USE_INJECTION_POINTS.
--
Michael

Commits

  1. injection_points: Add injection_points_list()

  2. Add InjectionPointList() to retrieve list of injection points