cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r946038 - /cassandra/trunk/src/java/org/apache/cassandra/locator/TokenMetadata.java
Date Wed, 19 May 2010 05:41:52 GMT
Author: jbellis
Date: Wed May 19 05:41:52 2010
New Revision: 946038

URL: http://svn.apache.org/viewvc?rev=946038&view=rev
Log:
log warning if we overwrite the ip associated with a token with another.  patch by Stu Hood;
reviewed by jbellis for CASSANDRA-872

Modified:
    cassandra/trunk/src/java/org/apache/cassandra/locator/TokenMetadata.java

Modified: cassandra/trunk/src/java/org/apache/cassandra/locator/TokenMetadata.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/locator/TokenMetadata.java?rev=946038&r1=946037&r2=946038&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/locator/TokenMetadata.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/locator/TokenMetadata.java Wed May 19 05:41:52
2010
@@ -32,8 +32,13 @@ import java.net.InetAddress;
 
 import org.apache.commons.lang.StringUtils;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 public class TokenMetadata
 {
+    private static Logger logger = LoggerFactory.getLogger(TokenMetadata.class);
+
     /* Maintains token to endpoint map of every node in the cluster. */
     private BiMap<Token, InetAddress> tokenToEndpointMap;
 
@@ -103,8 +108,11 @@ public class TokenMetadata
         {
             bootstrapTokens.inverse().remove(endpoint);
             tokenToEndpointMap.inverse().remove(endpoint);
-            if (!endpoint.equals(tokenToEndpointMap.put(token, endpoint)))
+            InetAddress prev = tokenToEndpointMap.put(token, endpoint);
+            if (!endpoint.equals(prev))
             {
+                if (prev != null)
+                    logger.warn("Token " + token + " changing ownership from " + prev + "
to " + endpoint);
                 sortedTokens = sortTokens();
             }
             leavingEndpoints.remove(endpoint);



Mime
View raw message