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_tn4mlmmuqif...@mail.gmail.com Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/aaf043257205ec523f1ba09a3856464d17cf2281 Modified Files -------------- doc/src/sgml/func.sgml | 30 +++++++- doc/src/sgml/monitoring.sgml | 4 ++ src/backend/catalog/system_views.sql | 10 +++ src/backend/storage/ipc/signalfuncs.c | 124 ++++++++++++++++++++++++++++++-- src/backend/utils/activity/wait_event.c | 3 + src/include/catalog/pg_proc.dat | 9 ++- src/include/utils/wait_event.h | 1 + 7 files changed, 174 insertions(+), 7 deletions(-)