From: | Michael Paquier <michael(at)paquier(dot)xyz> |
---|---|
To: | Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Cc: | Ashutosh Bapat <ashutosh(dot)bapat(at)gmail(dot)com> |
Subject: | Injection points: some tools to wait and wake |
Date: | 2024-02-19 06:01:40 |
Message-ID: | ZdLuxBk5hGpol91B@paquier.xyz |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi all,
(Ashutosh in CC as he was involved in the discussion last time.)
I have proposed on the original thread related to injection points to
have more stuff to be able to wait at an arbtrary point and wake at
will the process waiting so as it is possible to control the order of
actions taken in a test:
https://www.postgresql.org/message-id/ZTiV8tn_MIb_H2rE%40paquier.xyz
I didn't do that in the other thread out of time, but here is a patch
set to complete what I wanted, using a condition variable to wait and
wake processes:
- State is in shared memory, using a DSM tracked by the registry and
an integer counter.
- Callback to wait on a condition variable.
- SQL function to update the shared state and broadcast the update to
the condition variable.
- Use a custom wait event to track the wait in pg_stat_activity.
0001 requires no backend changes, only more stuff into the test module
injection_points so that could be backpatched assuming that the
backend is able to support injection points. This could be expanded
into using more variables and/or states, but I don't really see a
point in introducing more without a reason to do so, and I have no
need for more at the moment.
0002 is a polished version of the TAP test that makes use of this
facility, providing coverage for the bug fixed by 7863ee4def65
(reverting this commit causes the test to fail), where a restart point
runs across a promotion request. The trick is to stop the
checkpointer in the middle of a restart point and issue a promotion
in-between.
Thoughts and comments are welcome.
--
Michael
Attachment | Content-Type | Size |
---|---|---|
0001-injection_points-Add-routines-to-wait-and-wake-proce.patch | text/x-diff | 5.8 KB |
0002-Add-regression-test-for-restart-points-during-promot.patch | text/x-diff | 8.7 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2024-02-19 06:12:27 | Re: A new message seems missing a punctuation |
Previous Message | Robert Haas | 2024-02-19 05:58:38 | Re: PGC_SIGHUP shared_buffers? |