pgpool2.git / summary / log / commit / refs
commit d057e4a23a70b7a8d5f4b2cdd8dc27e59ace02b7
Author: Tatsuo Ishii <ishii at sraoss.co.jp>
Date: Wed Oct 20 00:34:22 2010 +0000
Fix bug with find_victim_node. If the number of
inserted/updated/deleted tuples at a victim node is 0, no failover
event happens.
See:
Subject: Re: [Pgpool-general] Replication failover problem
Date: Wed, 20 Oct 2010 09:24:30 +0900 (JST)
For mode details.
pool_proto_modules.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/pool_proto_modules.c b/pool_proto_modules.c
index 5a6df6364..5bf118dbe 100644
--- a/pool_proto_modules.c
+++ b/pool_proto_modules.c
@@ -1157,6 +1157,10 @@ POOL_STATUS ReadyForQuery(POOL_CONNECTION *frontend,
degenerate_backend_set(victim_nodes, number_of_nodes);
child_exit(1);
}
+ else
+ {
+ pool_error("ReadyForQuery: find_victim_nodes returned no victim node");
+ }
}
/*
@@ -2804,7 +2808,7 @@ static void overwrite_map_for_deallocate(POOL_QUERY_CONTEXT *query_context)
* master_node: The master node id. Less than 0 means ignore this parameter.
* number_of_nodes: Number of elements in victim nodes array.
*
- * Note: If no one wins and master_node > 0, winner would be the
+ * Note: If no one wins and master_node >= 0, winner would be the
* master and other nodes who has same number of tuples as the master.
*
* Caution: Returned victim node array is allocated in static memory
@@ -2900,7 +2904,7 @@ static int* find_victim_nodes(int *ntuples, int nmembers, int master_node, int *
/* Make victim nodes list */
for (i=0;i<nmembers;i++)
{
- if (ntuples[i] > 0 && ntuples[i] != majority_ntuples)
+ if (ntuples[i] >= 0 && ntuples[i] != majority_ntuples)
{
victim_nodes[(*number_of_nodes)++] = i;
}
[parent: 80576ae9542d]