Return-Path: X-Original-To: apmail-cassandra-commits-archive@www.apache.org Delivered-To: apmail-cassandra-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 65DB0D42C for ; Fri, 27 Jul 2012 15:19:50 +0000 (UTC) Received: (qmail 90823 invoked by uid 500); 27 Jul 2012 15:19:40 -0000 Delivered-To: apmail-cassandra-commits-archive@cassandra.apache.org Received: (qmail 90724 invoked by uid 500); 27 Jul 2012 15:19:40 -0000 Mailing-List: contact commits-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cassandra.apache.org Delivered-To: mailing list commits@cassandra.apache.org Received: (qmail 89378 invoked by uid 99); 27 Jul 2012 15:19:39 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 27 Jul 2012 15:19:39 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 4EFC91963E; Fri, 27 Jul 2012 15:19:39 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: yukim@apache.org To: commits@cassandra.apache.org X-Mailer: ASF-Git Admin Mailer Subject: [37/50] [abbrv] git commit: support for node removal with virtual nodes Message-Id: <20120727151939.4EFC91963E@tyr.zones.apache.org> Date: Fri, 27 Jul 2012 15:19:39 +0000 (UTC) support for node removal with virtual nodes Patch by Sam Overton and eevans; reviewed by Brandon Williams for CASSANDRA-4122 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/1a3661f6 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/1a3661f6 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/1a3661f6 Branch: refs/heads/cassandra-1.1 Commit: 1a3661f641e62d3fdc03eae32c60b2b33a5d90bb Parents: 66b96ee Author: Eric Evans Authored: Wed Jul 18 13:34:02 2012 -0500 Committer: Eric Evans Committed: Wed Jul 18 13:34:02 2012 -0500 ---------------------------------------------------------------------- .../apache/cassandra/service/StorageService.java | 15 ++++++--------- 1 files changed, 6 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/1a3661f6/src/java/org/apache/cassandra/service/StorageService.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/service/StorageService.java b/src/java/org/apache/cassandra/service/StorageService.java index a58653d..207bf69 100644 --- a/src/java/org/apache/cassandra/service/StorageService.java +++ b/src/java/org/apache/cassandra/service/StorageService.java @@ -1305,18 +1305,16 @@ public class StorageService implements IEndpointStateChangeSubscriber, StorageSe if (tokenMetadata.isMember(endpoint)) { String state = pieces[0]; - Token removeToken = tokenMetadata.getToken(endpoint); + Collection removeTokens = tokenMetadata.getTokens(endpoint); if (VersionedValue.REMOVED_TOKEN.equals(state)) { - excise(Collections.singleton(removeToken), - endpoint, - extractExpireTime(pieces, MessagingService.instance().getVersion(endpoint))); + excise(removeTokens, endpoint, extractExpireTime(pieces, MessagingService.instance().getVersion(endpoint))); } else if (VersionedValue.REMOVING_TOKEN.equals(state)) { if (logger.isDebugEnabled()) - logger.debug("Token " + removeToken + " removed manually (endpoint was " + endpoint + ")"); + logger.debug("Tokens " + removeTokens + " removed manually (endpoint was " + endpoint + ")"); // Note that the endpoint is being removed tokenMetadata.addLeavingEndpoint(endpoint); @@ -2580,8 +2578,7 @@ public class StorageService implements IEndpointStateChangeSubscriber, StorageSe { UUID hostId = tokenMetadata.getHostId(endpoint); Gossiper.instance.advertiseTokenRemoved(endpoint, hostId); - Token token = tokenMetadata.getToken(endpoint); - excise(Collections.singleton(token), endpoint); + excise(tokenMetadata.getTokens(endpoint), endpoint); } replicatingNodes.clear(); removingNode = null; @@ -2611,7 +2608,7 @@ public class StorageService implements IEndpointStateChangeSubscriber, StorageSe if (endpoint == null) throw new UnsupportedOperationException("Host ID not found."); - Token token = tokenMetadata.getToken(endpoint); + Collection tokens = tokenMetadata.getTokens(endpoint); if (endpoint.equals(myAddress)) throw new UnsupportedOperationException("Cannot remove self"); @@ -2669,7 +2666,7 @@ public class StorageService implements IEndpointStateChangeSubscriber, StorageSe } } - excise(Collections.singleton(token), endpoint); + excise(tokens, endpoint); // gossiper will indicate the token has left Gossiper.instance.advertiseTokenRemoved(endpoint, hostId);