Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=d8a... Commit: d8a4abe7ff8ff0954fb58fed9b384b087e81b1d0 Parent: e6e7f1837b53d8f2095392afc30aca411307730c Author: Lon Hohberger lhh@redhat.com AuthorDate: Mon Dec 6 15:01:55 2010 -0500 Committer: Lon Hohberger lhh@redhat.com CommitterDate: Mon Apr 4 16:58:34 2011 -0400
cman: Don't increment on LEAVING->MEMBER transition
If a node left the cluster prior using 'cman_tool leave', its internal state is set to NODESTATE_LEAVING.
Ordinarily, during the transition from NODESTATE_LEAVING to NODESTATE_DEAD, the member count is decremented. However, it is possible to rejoin the cluster membership from the NODESTATE_LEAVING state.
If this occurs, the cluster member count is incremented, but since the node never transitioned from LEAVING->DEAD, it was not previously decremented, causing an ever-increasing node count in 'cman_tool status'.
This patch resolves the issue by not incrementing the member count during a LEAVING->MEMBER transition.
Resolves: rhbz#649533
Signed-off-by: Lon Hohberger lhh@redhat.com --- cman/daemon/commands.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/cman/daemon/commands.c b/cman/daemon/commands.c index d4d9fd9..2948952 100644 --- a/cman/daemon/commands.c +++ b/cman/daemon/commands.c @@ -2246,9 +2246,12 @@ void add_ais_node(int nodeid, uint64_t incar, int total_members) if (node->state == NODESTATE_DEAD || node->state == NODESTATE_LEAVING) { gettimeofday(&node->join_time, NULL); node->incarnation = incar; - node->state = NODESTATE_MEMBER; node->leave_reason = 0; - cluster_members++; + /* If a node rejoins before it completes a leave, + * we should not increment cluster_members */ + if (node->state != NODESTATE_LEAVING) + cluster_members++; + node->state = NODESTATE_MEMBER; recalculate_quorum(0, 0); } }
cluster-commits@lists.fedorahosted.org