You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by yu...@apache.org on 2012/07/27 17:19:39 UTC
[37/50] [abbrv] git commit: support for node removal with virtual
nodes
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 <ee...@apache.org>
Authored: Wed Jul 18 13:34:02 2012 -0500
Committer: Eric Evans <ee...@apache.org>
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<Token> 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<Token> 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);