cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r1037076 - /cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/locator/NetworkTopologyStrategy.java
Date Fri, 19 Nov 2010 22:58:09 GMT
Author: jbellis
Date: Fri Nov 19 22:58:09 2010
New Revision: 1037076

URL: http://svn.apache.org/viewvc?rev=1037076&view=rev
Log:
add NTS debug logging
patch by jbellis;

Modified:
    cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/locator/NetworkTopologyStrategy.java

Modified: cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/locator/NetworkTopologyStrategy.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/locator/NetworkTopologyStrategy.java?rev=1037076&r1=1037075&r2=1037076&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/locator/NetworkTopologyStrategy.java
(original)
+++ cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/locator/NetworkTopologyStrategy.java
Fri Nov 19 22:58:09 2010
@@ -29,10 +29,13 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import com.google.common.collect.Multimap;
+import org.apache.commons.lang.StringUtils;
+
 import org.apache.cassandra.config.ConfigurationException;
 import org.apache.cassandra.dht.Token;
 import org.apache.cassandra.service.*;
 import org.apache.cassandra.thrift.ConsistencyLevel;
+import org.apache.cassandra.utils.FBUtilities;
 
 /**
  * This Replication Strategy takes a property file that gives the intended
@@ -62,12 +65,11 @@ public class NetworkTopologyStrategy ext
         if (configOptions != null)
         {
             for (Entry entry : configOptions.entrySet())
-            {
                 newDatacenters.put((String) entry.getKey(), Integer.parseInt((String) entry.getValue()));
-            }
         }
 
         datacenters = Collections.unmodifiableMap(newDatacenters);
+        logger.debug("Configured datacenter replicas are {}", FBUtilities.toString(datacenters));
     }
 
     public List<InetAddress> calculateNaturalEndpoints(Token searchToken, TokenMetadata
tokenMetadata)
@@ -116,6 +118,9 @@ public class NetworkTopologyStrategy ext
             if (dcEndpoints.size() < dcReplicas)
                 throw new IllegalStateException(String.format("datacenter (%s) has no more
endpoints, (%s) replicas still needed",
                                                               dcName, dcReplicas - dcEndpoints.size()));
+            if (logger.isDebugEnabled())
+                logger.debug("{} endpoints in datacenter {} for token {} ",
+                             new Object[] { StringUtils.join(dcEndpoints, ","), dcName, searchToken});
             endpoints.addAll(dcEndpoints);
         }
 



Mime
View raw message