cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tylerho...@apache.org
Subject [1/2] cassandra git commit: Improve PropertyFileSnitch log formatting
Date Thu, 06 Nov 2014 20:32:06 GMT
Repository: cassandra
Updated Branches:
  refs/heads/cassandra-2.1 9685622b3 -> ffe69c3d7


Improve PropertyFileSnitch log formatting

Patch by Liang Xie; reviewed by Tyler Hobbs for CASSANDRA-8183


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/6b3f3e96
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/6b3f3e96
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/6b3f3e96

Branch: refs/heads/cassandra-2.1
Commit: 6b3f3e9607c6e1113dd1e475b5b7c3ad91de6c03
Parents: 65f7990
Author: Liang Xie <liangxie@apache.org>
Authored: Thu Nov 6 13:37:03 2014 -0600
Committer: Tyler Hobbs <tyler@datastax.com>
Committed: Thu Nov 6 13:37:03 2014 -0600

----------------------------------------------------------------------
 CHANGES.txt                                              |  1 +
 .../org/apache/cassandra/locator/PropertyFileSnitch.java | 11 ++++++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/6b3f3e96/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index a469bbf..8a7697b 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.0.12:
+ * Improve PropertyFileSnitch logging (CASSANDRA-8183)
  * Abort liveRatio calculation if the memtable is flushed (CASSANDRA-8164)
  * Correctly handle non-text column names in cql3 (CASSANDRA-8178)
  * Fix deletion for indexes on primary key columns (CASSANDRA-8206)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6b3f3e96/src/java/org/apache/cassandra/locator/PropertyFileSnitch.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/locator/PropertyFileSnitch.java b/src/java/org/apache/cassandra/locator/PropertyFileSnitch.java
index 9138bc2..4f822c6 100644
--- a/src/java/org/apache/cassandra/locator/PropertyFileSnitch.java
+++ b/src/java/org/apache/cassandra/locator/PropertyFileSnitch.java
@@ -20,6 +20,7 @@ package org.apache.cassandra.locator;
 import java.io.InputStream;
 import java.net.InetAddress;
 import java.net.UnknownHostException;
+import java.util.Arrays;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Properties;
@@ -33,6 +34,7 @@ import org.apache.cassandra.service.StorageService;
 import org.apache.cassandra.utils.FBUtilities;
 import org.apache.cassandra.utils.ResourceWatcher;
 import org.apache.cassandra.utils.WrappedRunnable;
+import org.apache.commons.lang3.StringUtils;
 
 /**
  * Used to determine if two IP's are in the same datacenter or on the same rack.
@@ -185,7 +187,14 @@ public class PropertyFileSnitch extends AbstractNetworkTopologySnitch
             throw new ConfigurationException(String.format("Snitch definitions at %s do not
define a location for this node's broadcast address %s, nor does it provides a default",
                                                            SNITCH_PROPERTIES_FILENAME, FBUtilities.getBroadcastAddress()));
 
-        logger.debug("loaded network topology {}", FBUtilities.toString(reloadedMap));
+        if (logger.isDebugEnabled())
+        {
+            StringBuilder sb = new StringBuilder();
+            for (Map.Entry<InetAddress, String[]> entry : reloadedMap.entrySet())
+                sb.append(entry.getKey()).append(":").append(Arrays.toString(entry.getValue())).append(",
");
+            logger.debug("Loaded network topology from property file: {}", StringUtils.removeEnd(sb.toString(),
", "));
+        }
+
         endpointMap = reloadedMap;
         if (StorageService.instance != null) // null check tolerates circular dependency;
see CASSANDRA-4145
             StorageService.instance.getTokenMetadata().invalidateCachedRings();


Mime
View raw message