Fix messages when health check process starts.
authorTatsuo Ishii <ishii@sraoss.co.jp>
Tue, 2 Feb 2021 00:56:23 +0000 (09:56 +0900)
committerTatsuo Ishii <ishii@sraoss.co.jp>
Tue, 2 Feb 2021 00:56:23 +0000 (09:56 +0900)
Fix when health check process was restarted by reaper(), incorrect
"child process with pid: 14639 exited with success and will not be
restarted" was emitted.

Also enhance worker_fork_a_child() to emit a message that new worker
process started.

src/main/pgpool_main.c

index e6e6290b3df3d96c66aeb1684a4bdd3cd09063ed..8db7011655de8a7b9ca74ad4d5964f67cee804b6 100644 (file)
@@ -714,6 +714,9 @@ worker_fork_a_child(ProcessType type, void (*func) (), void *params)
 
                SetProcessGlobalVariables(type);
 
+               ereport(LOG,
+                               (errmsg("process started")));
+
                /* call child main */
                POOL_SETMASK(&UnBlockSig);
                health_check_timer_expired = 0;
@@ -2289,6 +2292,7 @@ reaper(void)
                bool            restart_child = true;
                bool            found = false;
                char       *exiting_process_name = process_name_from_pid(pid);
+               bool            process_health_check = false;
 
                /*
                 * Check if the terminating child wants pgpool main to go down with it
@@ -2424,6 +2428,8 @@ reaper(void)
                /* Check health check process */
                if (found == false)
                {
+                       process_health_check = true;
+
                        for (i = 0; i < NUM_BACKENDS; i++)
                        {
                                if (pid == health_check_pids[i])
@@ -2453,9 +2459,12 @@ reaper(void)
                }
                else
                {
-                       /* And the child was not restarted */
-                       ereport(LOG,
-                                       (errmsg("%s process with pid: %d exited with success and will not be restarted", exiting_process_name, pid)));
+                       if (process_health_check == false)
+                       {
+                               /* And the child was not restarted */
+                               ereport(LOG,
+                                               (errmsg("%s process with pid: %d exited with success and will not be restarted", exiting_process_name, pid)));
+                       }
                }
 
        }