From 1f9af12bfd2cd31bb001ccb0a95926700d124f9e Mon Sep 17 00:00:00 2001 From: Tatsuo Ishii Date: Tue, 2 Feb 2021 09:56:23 +0900 Subject: [PATCH] Fix messages when health check process starts. 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 | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/main/pgpool_main.c b/src/main/pgpool_main.c index e6e6290b3..8db701165 100644 --- a/src/main/pgpool_main.c +++ b/src/main/pgpool_main.c @@ -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))); + } } } -- 2.39.5