Fix the watchdog process not reloading configurations.
authorBo Peng <pengbo@sraoss.co.jp>
Mon, 25 Nov 2024 08:17:12 +0000 (17:17 +0900)
committerBo Peng <pengbo@sraoss.co.jp>
Mon, 25 Nov 2024 08:17:50 +0000 (17:17 +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 0f5f42f24e3794074ee13dc34954be621bf3a72f..b704479ebc71aff7ed54ff43f0c27a0533e6d97c 100644 (file)
@@ -2712,18 +2712,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);
        }
 }
 
@@ -3943,10 +3952,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 e4444742616a763e78c37e80fe8516954cee81e9..2c1baf6731448d206cb5d804cf3a722c2e07882c 100644 (file)
@@ -1096,6 +1096,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);