Fix the watchdog process not reloading configurations.
authorBo Peng <pengbo@sraoss.co.jp>
Mon, 25 Nov 2024 07:53:54 +0000 (16:53 +0900)
committerBo Peng <pengbo@sraoss.co.jp>
Mon, 25 Nov 2024 07:53:54 +0000 (16:53 +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 60bc675b1763f9613cf39e7e4b4e665e80777a51..1fbc2ccd9896d3df97ebd605d7020a6e029890d6 100644 (file)
@@ -2204,18 +2204,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);
        }
 }
 
@@ -3445,10 +3454,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 0c29cc68dac348c6eb067d35dc493f89c91c89dc..8b6fb76ccf3f5579513dcf3fd8e241ce0c67fdea 100644 (file)
@@ -1182,6 +1182,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);