Re: Extend injection_points_attach() to accept a user-defined function

From: Rahila Syed <rahilasyed90(at)gmail(dot)com>
To: Mihail Nikalayeu <mihailnikalayeu(at)gmail(dot)com>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Extend injection_points_attach() to accept a user-defined function
Date: 2025-11-04 08:47:44
Message-ID: CAH2L28ukX+MbBQDZXMVpRZHyjm6R-L3Y5-oMzZXxox2VTwcWzg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Mihail,

Thank you for looking into this thread.

>
> I thought it may help me to implement some kind of notice+wait
> required for [1] in order to stabilize the tests.
>
> Is it possible to do something like this in the attached function?
>
> RAISE NOTICE 'going to wait';
> SELECT injection_points_run(some_point_with_wait"); -- wait called
> inside injection point handler
>

One way to achieve this using the proposed SQL function is to create a
C function in a module like injection_points, which combines injection_notice
and injection_wait. You can then pass this combined function as an argument
to the proposed injection_points_attach() function.

Something as follows:

SELECT injection_points_attach('TestInjectionNoticeFunc',
'injection_points', 'injection_notice_and_wait');

> Also, I think it is a good idea to add some tests to injection_points.sql.
>

PFA a rebased patch that contains the test.
The tests use the newly added SQL function to attach the injection_notice
function to an injection point

Thank you,
Rahila Syed

Attachment Content-Type Size
v3-0001-Overload-the-injection_points_attach-sql-function.patch application/octet-stream 5.5 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Quan Zongliang 2025-11-04 08:53:39 Re: ago(interval) → timestamptz
Previous Message Jim Jones 2025-11-04 08:27:59 Re: [PATCH] Add pg_get_tablespace_ddl() function to reconstruct CREATE TABLESPACE statement