pgpool2.git / summary / log / commit / refs

commit    63546e97a7b379bbefe3e238288f4098152f16a7
Author:   Tatsuo Ishii <ishii at sraoss.co.jp>
Date:     Wed Jul 14 07:37:39 2010 +0000

    Check health DB nodes before doing delay checking.


pool_worker_child.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pool_worker_child.c b/pool_worker_child.c index cb9692479..c3e72aabf 100644 --- a/pool_worker_child.c +++ b/pool_worker_child.c @@ -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)) [parent: a6ec5379a61c]