Inconsistent usage of BACKEND_* symbols

Started by Kyotaro Horiguchiover 6 years ago2 messages
#1Kyotaro Horiguchi
horikyota.ntt@gmail.com
1 attachment(s)

Hello.

While I looked around shutdown sequence, pmdie() uses
"BACKEND_TYPE_AUTOVAC | BACKEND_TYPE_BGWORKER" for sending signal
and PostmasterStateMachine counts them using
BACKEND_TYPE_WORKER. It is the only usage of the combined one. It
seems to me just a leftover of da07a1e856.

regards.

--
Kyotaro Horiguchi
NTT Open Source Software Center

Attachments:

Use_combined_backend_type_macros.patchtext/x-patch; charset=us-asciiDownload
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c
index eb9e0221f8..a071c3de87 100644
--- a/src/backend/postmaster/postmaster.c
+++ b/src/backend/postmaster/postmaster.c
@@ -2740,8 +2740,8 @@ pmdie(SIGNAL_ARGS)
 			{
 				/* autovac workers are told to shut down immediately */
 				/* and bgworkers too; does this need tweaking? */
-				SignalSomeChildren(SIGTERM,
-								   BACKEND_TYPE_AUTOVAC | BACKEND_TYPE_BGWORKER);
+				SignalSomeChildren(SIGTERM, BACKEND_TYPE_WORKER);
+
 				/* and the autovac launcher too */
 				if (AutoVacPID != 0)
 					signal_child(AutoVacPID, SIGTERM);
@@ -2821,8 +2821,7 @@ pmdie(SIGNAL_ARGS)
 						(errmsg("aborting any active transactions")));
 				/* shut down all backends and workers */
 				SignalSomeChildren(SIGTERM,
-								   BACKEND_TYPE_NORMAL | BACKEND_TYPE_AUTOVAC |
-								   BACKEND_TYPE_BGWORKER);
+								   BACKEND_TYPE_NORMAL | BACKEND_TYPE_WORKER);
 				/* and the autovac launcher too */
 				if (AutoVacPID != 0)
 					signal_child(AutoVacPID, SIGTERM);
#2Michael Paquier
michael@paquier.xyz
In reply to: Kyotaro Horiguchi (#1)
Re: Inconsistent usage of BACKEND_* symbols

On Mon, Sep 30, 2019 at 04:39:59PM +0900, Kyotaro Horiguchi wrote:

@@ -2740,8 +2740,8 @@ pmdie(SIGNAL_ARGS)
{
/* autovac workers are told to shut down immediately */
/* and bgworkers too; does this need tweaking? */
-            SignalSomeChildren(SIGTERM,
-                               BACKEND_TYPE_AUTOVAC | BACKEND_TYPE_BGWORKER);
+            SignalSomeChildren(SIGTERM, BACKEND_TYPE_WORKER);
+

For this one the comment would be inconsistent with the flags listed.

/* and the autovac launcher too */
if (AutoVacPID != 0)
signal_child(AutoVacPID, SIGTERM);
@@ -2821,8 +2821,7 @@ pmdie(SIGNAL_ARGS)
(errmsg("aborting any active transactions")));
/* shut down all backends and workers */
SignalSomeChildren(SIGTERM,
-                               BACKEND_TYPE_NORMAL | BACKEND_TYPE_AUTOVAC |
-                               BACKEND_TYPE_BGWORKER);
+                               BACKEND_TYPE_NORMAL | BACKEND_TYPE_WORKER);

Okay for this one.
--
Michael