Fix health check process to not start.
authorTatsuo Ishii <ishii@postgresql.org>
Tue, 6 Jan 2026 10:18:39 +0000 (19:18 +0900)
committerTatsuo Ishii <ishii@postgresql.org>
Tue, 6 Jan 2026 10:18:39 +0000 (19:18 +0900)
Previously pgpool_main() did not start a health check process if the
backend node is down.  This prevented auto_failback from working.
Pgpool reads status from pool_status file when "-D" option is not
present.  If the status recorded in the file is "down", pgpool will
not start health check process for the node.  Since auto_failback is
invoked from health check process, this means that auto_failback does
not work for the backend node.

Fix is, unconditionally start health check process.

Author: Tatsuo Ishii <ishii@postgresql.org>
Reported-by: Meng Feilong
Discussion: https://github.com/pgpool/pgpool2/issues/140
Backpatch-through: v4.3

src/main/pgpool_main.c

index 4d88c5815ea253471167dfe7e5bf39f0270323ec..5e7832a8824649b85e9c8fab0d0964a1517b08c5 100644 (file)
@@ -5,7 +5,7 @@
  * pgpool: a language independent connection pool server for PostgreSQL
  * written by Tatsuo Ishii
  *
- * Copyright (c) 2003-2025     PgPool Global Development Group
+ * Copyright (c) 2003-2026     PgPool Global Development Group
  *
  * Permission to use, copy, modify, and distribute this software and
  * its documentation for any purpose and without fee is hereby
@@ -628,10 +628,8 @@ PgpoolMain(bool discard_status, bool clear_memcache_oidmaps)
 
        /* Fork health check process */
        for (i = 0; i < NUM_BACKENDS; i++)
-       {
-               if (VALID_BACKEND(i))
-                       health_check_pids[i] = worker_fork_a_child(PT_HEALTH_CHECK, do_health_check_child, &i);
-       }
+               health_check_pids[i] =
+                       worker_fork_a_child(PT_HEALTH_CHECK, do_health_check_child, &i);
 
        if (sigsetjmp(local_sigjmp_buf, 1) != 0)
        {