Re: injection_points: Switch wait/wakeup to use atomics rather than latches - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: injection_points: Switch wait/wakeup to use atomics rather than latches
Date
Msg-id ahpj-2ng4YN3cA0W@paquier.xyz
Whole thread
In response to Re: injection_points: Switch wait/wakeup to use atomics rather than latches  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
On Fri, May 29, 2026 at 12:00:46PM -0400, Robert Haas wrote:
> On Fri, May 29, 2026 at 9:31 AM Heikki Linnakangas <hlinnaka@iki.fi> wrote:
>> They only work after you have a PGPROC slot. If you want to inject code
>> to authentication, or into postmaster, you cannot use them.
>
> OK, got it now.

It seems like Heikki's comment was better worded than mine.

Also mentioned upthread, but the lack of PGPROC also means a lack of
monitoring as wait events cannot be tracked.  Currently, we rely on
that in the TAP tests.  For cases where the procs are not available, I
don't have a better idea than generating a LOG entry after the wait
counts have been generated (with a PID) and couple that with a poll of
the server logs to let a script understand that a process is in
waiting mode.

As a whole, I don't think that we should try to be fancy with the
implementation, which is why I have used primitives that should work
in any context, and I'm not convinced that this is worth its own
facility if that just means more responsiveness (in most cases the
wait should not take more than a couple ms to notice a wakeup).  I'm
open to more fancy ideas, of course.
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Nisha Moond
Date:
Subject: Re: Proposal: Conflict log history table for Logical Replication
Next
From: Michael Paquier
Date:
Subject: Re: [PATCH v1] Fix doubled-word typos and punctuation in code comments