Re: Extend injection_points_attach() to accept a user-defined function - Mailing list pgsql-hackers

From Rahila Syed
Subject Re: Extend injection_points_attach() to accept a user-defined function
Date
Msg-id CAH2L28ukX+MbBQDZXMVpRZHyjm6R-L3Y5-oMzZXxox2VTwcWzg@mail.gmail.com
Whole thread Raw
In response to Re: Extend injection_points_attach() to accept a user-defined function  (Mihail Nikalayeu <mihailnikalayeu@gmail.com>)
List 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

pgsql-hackers by date:

Previous
From: Jim Jones
Date:
Subject: Re: [PATCH] Add pg_get_tablespace_ddl() function to reconstruct CREATE TABLESPACE statement
Next
From: Quan Zongliang
Date:
Subject: Re: ago(interval) → timestamptz