pgsql: Add functions to wait for backend termination

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Add functions to wait for backend termination
Date: 2021-04-08 09:41:25
Message-ID: E1lURAD-0007Kq-8D@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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

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(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Julien Rouhaud 2021-04-08 09:42:21 Re: pgsql: Move pg_stat_statements query jumbling to core.
Previous Message Amit Kapila 2021-04-08 09:22:26 Re: pgsql: Move pg_stat_statements query jumbling to core.