Fix the watchdog process not reloading configurations.
authorBo Peng <[email protected]>
Mon, 25 Nov 2024 08:17:12 +0000 (17:17 +0900)
committerBo Peng <[email protected]>
Mon, 25 Nov 2024 08:18:22 +0000 (17:18 +0900)
The reload_config() function in Pgpool-II should send a SIGHUP signal to the watchdog process.

src/main/pgpool_main.c
src/watchdog/watchdog.c

index a064ffa6d8b1caeec7773255f3cb4067bb592e5f..04d2962a4d16a58b0db821074727b66c199bcff3 100644 (file)
@@ -3036,18 +3036,27 @@ kill_all_children(int sig)
                        }
                }
        }
-       /* make PCP process reload as well */
-       if (sig == SIGHUP && pcp_pid > 0)
-               kill(pcp_pid, sig);
 
-       /* make health check process reload as well */
        if (sig == SIGHUP)
        {
+               /* make PCP process reload as well */
+               if (pcp_pid > 0)
+                       kill(pcp_pid, sig);
+               
+               /* make health check process reload as well */
                for (i = 0; i < NUM_BACKENDS; i++)
                {
                        if (health_check_pids[i] > 0)
                                kill(health_check_pids[i], sig);
                }
+
+               /* make worker process reload as well */
+               if (worker_pid > 0) 
+                       kill(worker_pid, sig);
+
+               /* make watchdog process reload as well */
+               if (watchdog_pid > 0) 
+                       kill(watchdog_pid, sig);
        }
 }
 
@@ -4229,10 +4238,8 @@ reload_config(void)
        MemoryContextSwitchTo(oldContext);
        if (pool_config->enable_pool_hba)
                load_hba(hba_file);
-       kill_all_children(SIGHUP);
 
-       if (worker_pid)
-               kill(worker_pid, SIGHUP);
+       kill_all_children(SIGHUP);
 }
 
 /* Call back function to unlink the file */
index cfd31361dc8e30343f2537da3b61369379404389..e4a5726dff55c0f1db6c26caf6968dd098bfb016 100644 (file)
@@ -1063,6 +1063,8 @@ check_signals(void)
        /* reload config file signal? */
        if (reload_config_signal)
        {
+               ereport(LOG,
+                               (errmsg("reloading config file")));
                MemoryContext oldContext = MemoryContextSwitchTo(TopMemoryContext);
 
                pool_get_config(get_config_file_name(), CFGCXT_RELOAD);