| From: | Michael Paquier <michael(at)paquier(dot)xyz> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: injection_points: Switch wait/wakeup to rely on atomics |
| Date: | 2026-07-08 05:34:49 |
| Message-ID: | E1whKvo-0006XE-1f@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
injection_points: Switch wait/wakeup to rely on atomics
This change switches the implementation of wait and wakeups in the
module injection_points to not rely anymore on condition variables,
using a more primitive implementation based on atomics. The former
implementation required a PGPROC, making it impossible to inject waits
in the postmaster or during authentication. A couple of use cases have
popped up for these in the past, where this would have become handy.
The loop in the wait callback that relied on a condition variable is
replaced by an atomic counter, whose check increases over time in an
exponential manner (starts at 10us for quick responsiveness, up to
100ms).
This change may be backpatched at some point depending on how much
testing coverage is wanted. Let's limit ourselves to HEAD for now,
checking things first with the buildfarm.
Creating a wait still requires the SQL interface. We are looking at
expanding that with an alternative implementation, so as early startup
or authentication waits would become possible. This refactoring piece
is mandatory to achieve this goal.
Reviewed-by: Andrey Borodin <x4mmm(at)yandex-team(dot)ru>
Discussion: https://postgr.es/m/aher0VsjJ8xeNgLq@paquier.xyz
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/8daeaa9b642c3c23cbc516da80d50aade6f4dc07
Modified Files
--------------
.../modules/injection_points/injection_points.c | 56 +++++++++++-----------
1 file changed, 29 insertions(+), 27 deletions(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Heikki Linnakangas | 2026-07-08 07:25:07 | pgsql: Fix misspelling in docs |
| Previous Message | Michael Paquier | 2026-07-08 04:23:03 | pgsql: Fix more Datum conversion inconsistencies |