v5-0001-improve-warning-message-in-pg_signal_backend.patch

application/octet-stream

Filename: v5-0001-improve-warning-message-in-pg_signal_backend.patch
Type: application/octet-stream
Part: 0
Message: Re: Should we improve "PID XXXX is not a PostgreSQL server process" warning for pg_terminate_backend(<<postmaster_pid>>)?

Patch

Format: format-patch
Series: patch v5-0001
Subject: improve warning message in pg_signal_backend()
File+
src/backend/storage/ipc/signalfuncs.c 8 1
From faf883950a4fd46ed588c74f7828c59117841ba8 Mon Sep 17 00:00:00 2001
From: Nathan Bossart <bossartn@amazon.com>
Date: Tue, 7 Dec 2021 22:31:47 +0000
Subject: [PATCH v5 1/1] improve warning message in pg_signal_backend()

---
 src/backend/storage/ipc/signalfuncs.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/backend/storage/ipc/signalfuncs.c b/src/backend/storage/ipc/signalfuncs.c
index de69d60e79..f509fb0456 100644
--- a/src/backend/storage/ipc/signalfuncs.c
+++ b/src/backend/storage/ipc/signalfuncs.c
@@ -57,6 +57,12 @@ pg_signal_backend(int pid, int sig)
 	 * arbitrary process to prevent that. But since so far all the callers of
 	 * this mechanism involve some request for ending the process anyway, that
 	 * it might end on its own first is not a problem.
+	 *
+	 * Note that proc will also be NULL if the pid refers to an auxiliary
+	 * process or the postmaster (neither of which can be signaled via
+	 * pg_signal_backend()).  The warning message is intentionally phrased to
+	 * work for both non-PostgreSQL processes and the PostgreSQL processes that
+	 * cannot be signaled with this function.
 	 */
 	if (proc == NULL)
 	{
@@ -65,7 +71,8 @@ pg_signal_backend(int pid, int sig)
 		 * if one backend terminated on its own during the run.
 		 */
 		ereport(WARNING,
-				(errmsg("PID %d is not a PostgreSQL server process", pid)));
+				(errmsg("PID %d is not a PostgreSQL backend process", pid)));
+
 		return SIGNAL_BACKEND_ERROR;
 	}
 
-- 
2.16.6