Re: Injection point: fix race condition between attach and cleanup

From: "Koshi Shibagaki (Fujitsu)" <shibagaki(dot)koshi(at)fujitsu(dot)com>
To: "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>
Cc: "'pgsql-hackers(at)lists(dot)postgresql(dot)org'" <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, Alexander Lakhin <exclusion(at)gmail(dot)com>, 'Michael Paquier' <michael(at)paquier(dot)xyz>
Subject: Re: Injection point: fix race condition between attach and cleanup
Date: 2026-11-13 13:58:25
Message-ID: TY5PR01MB18445F9D66B8317B84A44786BFA7F2@TY5PR01MB18445.jpnprd01.prod.outlook.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Kuroda-san

> InjectionPointDetach()
> is implemented in the core, but the condition is controlled in the extension side
> thus it's opaque from the core.

As an alternative, could we let the test module supply a callback,
similar to a hook, that checks whether an injection point may be detached?

The callback would run under the same lock as the removal, keeping
checks such as PID matching in the test module.

However, this would still make the core API more complicated. Since I
cannot think of another concrete use case, I am not sure the benefit
justifies adding this mechanism. Would it nevertheless be worth
considering as an alternative?

Koshi Shibagaki
FUJITSU LIMITED
https://www.fujitsu.com/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bertrand Drouvot 2026-11-13 13:59:32 Re: Assertion failure in update_local_synced_slot(), slotsync.c:364
Previous Message Matheus Alcantara 2026-11-13 13:26:57 Re: extension_control_path: ignore empty elements and deduplicate directories