Start health check process at failback.
authorTatsuo Ishii <ishii@postgresql.org>
Fri, 22 Jun 2018 08:27:16 +0000 (17:27 +0900)
committerTatsuo Ishii <ishii@postgresql.org>
Fri, 22 Jun 2018 08:27:16 +0000 (17:27 +0900)
Health check process will not start if a backend node is in down
status when Pgpool-II starts.  However when the node fails back,
health check should start so that it can detects the failure of the
node.

Per bug 407.

src/main/pgpool_main.c

index 619ae7be6eca14fa11bd70b8f8d82265ae4362f3..08e60c47c5058e6e1ec814df716acf86c529d113 100644 (file)
@@ -2094,6 +2094,19 @@ static void failover(void)
                                         BACKEND_INFO(node_id).backend_hostname,
                                         BACKEND_INFO(node_id).backend_port)));
 
+                       /* Fork health check process if needed */
+                       for (i=0;i<NUM_BACKENDS;i++)
+                       {
+                               if (health_check_pids[i] == 0)
+                               {
+                                       ereport(LOG,
+                                                       (errmsg("start health check process for host %s(%d)",
+                                                                       BACKEND_INFO(node_id).backend_hostname,
+                                                                       BACKEND_INFO(node_id).backend_port)));
+
+                                       health_check_pids[i] = worker_fork_a_child(PT_HEALTH_CHECK, do_health_check_child, &i);
+                               }
+                       }
                }
                else if (reqkind == PROMOTE_NODE_REQUEST)
                {