Add functions to wait for backend termination
Magnus Hagander <magnus@hagander.net>
Add functions to wait for backend termination
This adds a function, pg_wait_for_backend_termination(), and a new
timeout argument to pg_terminate_backend(), which will wait for the
backend to actually terminate (with or without signaling it to do so
depending on which function is called). The default behaviour of
pg_terminate_backend() remains being timeout=0 which does not waiting.
For pg_wait_for_backend_termination() the default wait is 5 seconds.
Author: Bharath Rupireddy
Reviewed-By: Fujii Masao, David Johnston, Muhammad Usama,
Hou Zhijie, Magnus Hagander
Discussion: https://postgr.es/m/CALj2ACUBpunmyhYZw-kXCYs5NM+h6oG_7Df_Tn4mLmmUQifkqA@mail.gmail.com
Files
| Path | Change | +/− |
|---|---|---|
| doc/src/sgml/func.sgml | modified | +29 −1 |
| doc/src/sgml/monitoring.sgml | modified | +4 −0 |
| src/backend/catalog/system_views.sql | modified | +10 −0 |
| src/backend/storage/ipc/signalfuncs.c | modified | +120 −4 |
| src/backend/utils/activity/wait_event.c | modified | +3 −0 |
| src/include/catalog/pg_proc.dat | modified | +7 −2 |
| src/include/utils/wait_event.h | modified | +1 −0 |
Documentation touched
Discussion
- A new function to wait for the backend exit after termination 57 messages · 2020-10-21 → 2021-06-15