Re: Adding facility for injection points (or probe points?) for more advanced tests

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
Cc: Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>, Dilip Kumar <dilipbalaut(at)gmail(dot)com>, Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Adding facility for injection points (or probe points?) for more advanced tests
Date: 2025-02-04 05:30:33
Message-ID: eb11b1626b01cb410577f265c67b50e65caff29a.camel@j-davis.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, 2024-01-23 at 12:32 +0900, Michael Paquier wrote:
> Slightly off topic and while I don't forget about it..  Please find
> attached a copy of the patch posted around [1] to be able to define
> injection points with input arguments, so as it is possible to
> execute
> callbacks with values coming from the code path where the point is
> attached.
>
> For example, a backend could use this kind of macro to have a
> callback
> attached to this point use some runtime value:
> INJECTION_POINT_1ARG("InjectionPointBoo", &some_value);

That sounds useful, but not necessarily required, for the HashAgg tests
I just posted[1].

One extra benefit of supporting arguments is that it would be a more
flexible way to change the local state around the injection point.
Right now the only way is by using IS_INJECTION_POINT_ATTACHED(), which
doesn't permit callback-defined conditions, etc.

If you do add suppport for arguments, would it make sense to just have
all callback functions take a single "void *" argument, rather than
adding branches for the zero-argument and the one-argument case?

+1 to the idea, but I'm fine waiting for additional use cases to get
the API right.

Regards,
Jeff Davis

[1]
https://www.postgresql.org/message-id/ff4e59305e5d689e03cd256a736348d3e7958f8f.camel@j-davis.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Davis 2025-02-04 05:35:52 Re: injection points for hash aggregation
Previous Message Amit Kapila 2025-02-04 05:15:09 Re: Introduce XID age and inactive timeout based replication slot invalidation