Re: Allow a condition string in an injection point

From: Sami Imseih <samimseih(at)gmail(dot)com>
To: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, Daniel Gustafsson <daniel(at)yesql(dot)se>, Nathan Bossart <nathandbossart(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, Daniil Davydov <3danissimo(at)gmail(dot)com>
Subject: Re: Allow a condition string in an injection point
Date: 2026-08-10 22:31:00
Message-ID: CAA5RZ0sfRTST8RQaoVXfEnVRchRtAP_YhFFUVcm6dC6v1TAChw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

Thanks all for the reviews/comments.

v2- attached addresses Bertrand's points. Fixed all.
I also included some additional tests for injection_points_attach()
since this function is no longer STRICT.

On Mon, Aug 3, 2026 at 9:09 AM Daniel Gustafsson <daniel(at)yesql(dot)se> wrote:
>
> > On 3 Aug 2026, at 13:16, Michael Paquier <michael(at)paquier(dot)xyz> wrote:
>
> FWIW, I like the idea proposed in this patch.
>
> > While looking at this patch, I'd like to have at least one valid test
> > using it.
>
> +1, a test using the new facility seems like a requirement for this. At some
> point we should probably consider documenting this module with a README, but
> that's for another patch.
>
> --
> Daniel Gustafsson

The facilities that this will be useful for are those in which the
injection_point_set_local()
cannot be used and thus we cannot clearly determine if the injection
point is reached
at the correct condition. [0] was one example, which led to this
thread, but we dealt
with this by using wait_for_log to ensure that we reached the correct code path.

Looking at [1], if we want to test toast reloptions for autovacuum, we
will need some type
of way to ensure that we are inspecting the correct relations for the
test. Since
autovacuum cannot rely on injection_point_set_local because workers will not
set the local injection point, we can use string conditions to ensure
we reached the
correct table. the nocfbot test attached shows how we can build such tests for
autovacuum. The test fails without the latest patchset in [1]. CCing Nathan as
his patch is being discussed.

Without this condition string, to implement such a test, we will need
a NOTICE to log
and we will need to use regexp to examine the log to make sure our
toast table fired
at the correct injection point. With the condition string, we can
simply just use
wait_for_event since we know which table the injection point will fire on.

This feature could enable further autovacuum tests as well.

[0] https://www.postgresql.org/message-id/adWcVrX3jrHPoCmD%40paquier.xyz
[1] https://www.postgresql.org/message-id/aFrUkYVyATVk2nsD%40nathan

--
Sami Imseih
Amazon Web Services (AWS)

Attachment Content-Type Size
nocfbot-v2-0002-test-autovacuum-toast-reloptions.patch application/octet-stream 6.0 KB
v2-0001-Allow-a-condition-string-in-an-injection-point.patch application/octet-stream 12.5 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2026-08-10 23:00:06 Re: Introduce psystem() to replace system()
Previous Message Peter Smith 2026-08-10 22:22:18 Re: Improve errmsg for publication membership