Add pg_get_injection_points() for information of injection points

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Add pg_get_injection_points() for information of injection points
Date: 2025-04-14 00:36:32
Message-ID: Z_xYkA21KyLEHvWR@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi all,

One thing that's been lacking in injection points is the possibility
to look at the state of the injection points in shared memory through
some SQL. This was on my tablets for some time, but I have not taken
the time to do the actual legwork.

The attached patch adds a SRF that returns a set of tuples made of the
name, library and function for all the injection points attached to
the system. This implementation relies on a new function added in
injection_point.c, called InjectionPointList(), that retrieves a
palloc()'d array of the injection points, hiding from the callers the
internals of what this stuff does with the shmem array lookup.

This is useful for monitoring or in tests, to make sure for example
that nothing is left around at the end of a script. I have a
different proposal planned for this area of the code, where this
function would be good to have, but I am sending an independent patch
as this stuff is useful on its own.

The patch includes a couple of tests and some documentation.

Thanks,
--
Michael

Attachment Content-Type Size
0001-Add-pg_get_injection_points.patch text/x-diff 12.7 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Richard Guo 2025-04-14 01:25:06 Re: New committer: Jacob Champion
Previous Message Thomas Munro 2025-04-14 00:25:12 Re: Automatically sizing the IO worker pool