Check health DB nodes before doing delay checking.
authorTatsuo Ishii <ishii at sraoss.co.jp>
Wed, 14 Jul 2010 07:37:39 +0000 (07:37 +0000)
committerTatsuo Ishii <ishii at sraoss.co.jp>
Wed, 14 Jul 2010 07:37:39 +0000 (07:37 +0000)
pool_worker_child.c

index cb9692479bd32a1e4e001b2ded16c3428f5c9888..c3e72aabf92c096c2ed7eccfc3ad2bf5f72c03f5 100644 (file)
@@ -161,6 +161,7 @@ static void establish_persistent_connection(void)
 static void check_replication_time_lag(void)
 {
        int i;
+       int active_nodes = 0;
        POOL_STATUS sts;
        POOL_SELECT_RESULT *res;
        unsigned long long int lsn[MAX_NUM_BACKENDS];
@@ -174,6 +175,20 @@ static void check_replication_time_lag(void)
                return;
        }
 
+       /* Count healthy nodes */
+       for (i=0;i<NUM_BACKENDS;i++)
+       {
+               if (VALID_BACKEND(i))
+                       active_nodes++;
+       }
+
+       if (active_nodes <= 1)
+       {
+               /* If there's only one or less active node, there's no point
+                * to do checking */
+               return;
+       }
+
        for (i=0;i<NUM_BACKENDS;i++)
        {
                if (!VALID_BACKEND(i))