cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Lon Hohberger <lhh@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH] cman: Don't increment on LEAVING->MEMBER transition
Date: Tue,  7 Dec 2010 10:13:01 -0500	[thread overview]
Message-ID: <1291734781-16774-1-git-send-email-lhh@redhat.com> (raw)

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 |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/cman/daemon/commands.c b/cman/daemon/commands.c
index d4d9fd9..e62f33c 100644
--- a/cman/daemon/commands.c
+++ b/cman/daemon/commands.c
@@ -2245,10 +2245,13 @@ 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);
+		/* If a node rejoins before it completes a leave,
+		 * we should not increment cluster_members */
+		if (node->state != NODESTATE_LEAVING)
+			cluster_members++;
 		node->incarnation = incar;
 		node->state = NODESTATE_MEMBER;
 		node->leave_reason = 0;
-		cluster_members++;
 		recalculate_quorum(0, 0);
 	}
 }
-- 
1.7.2.3



             reply	other threads:[~2010-12-07 15:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-07 15:13 Lon Hohberger [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-03-22  1:06 [Cluster-devel] [PATCH] cman: Don't increment on LEAVING->MEMBER transition Lon Hohberger
2011-03-22  8:33 ` Fabio M. Di Nitto
2011-03-22 10:28   ` Christine Caulfield

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1291734781-16774-1-git-send-email-lhh@redhat.com \
    --to=lhh@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).