cluster: RHEL57 - cman: Don't increment on LEAVING->MEMBER transition

Lon Hohberger lon at fedoraproject.org
Fri Apr 8 13:46:56 UTC 2011


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=8d94f0871db6236ac3caa366560578976477d0eb
Commit:        8d94f0871db6236ac3caa366560578976477d0eb
Parent:        1837d87a8548f2244db2634897ad831d90217a44
Author:        Lon Hohberger <lhh at redhat.com>
AuthorDate:    Mon Dec 6 15:01:55 2010 -0500
Committer:     Lon Hohberger <lhh at redhat.com>
CommitterDate: Fri Apr 8 09:31:15 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 at redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto at redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie at redhat.com>
---
 cman/daemon/commands.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/cman/daemon/commands.c b/cman/daemon/commands.c
index 6ffe9e5..6c91d7a 100644
--- a/cman/daemon/commands.c
+++ b/cman/daemon/commands.c
@@ -1994,9 +1994,12 @@ void add_ais_node(int nodeid, uint64_t incarnation, int total_members)
 
 	if (node->state == NODESTATE_DEAD || node->state == NODESTATE_LEAVING) {
 		gettimeofday(&node->join_time, NULL);
+		/* If a node rejoins before it completes a leave,
+		 * we should not increment cluster_members */
+		if (node->state != NODESTATE_LEAVING)
+			cluster_members++;
 		node->incarnation = incarnation;
 		node->state = NODESTATE_MEMBER;
-		cluster_members++;
 		recalculate_quorum(0, 0);
 	}
 }


More information about the cluster-commits mailing list