cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject [43/50] [abbrv] git commit: use cannonical host for local node in nodetool info patch by Rick Branson; reviewed by jbellis for CASSANDRA-3556
Date Thu, 05 Jan 2012 20:00:30 GMT
use cannonical host for local node in nodetool info
patch by Rick Branson; reviewed by jbellis for CASSANDRA-3556

git-svn-id: https://svn.apache.org/repos/asf/cassandra/branches/cassandra-0.8@1209608 13f79535-47bb-0310-9956-ffa450edef68


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

Branch: refs/heads/trunk
Commit: 41ef1b550ac0c3fc94f05cf50afd26f7c64bf4ea
Parents: c1a6e5d
Author: Jonathan Ellis <jbellis@apache.org>
Authored: Fri Dec 2 17:59:06 2011 +0000
Committer: Jonathan Ellis <jbellis@apache.org>
Committed: Fri Dec 2 17:59:06 2011 +0000

----------------------------------------------------------------------
 CHANGES.txt                                        |    4 ++
 src/java/org/apache/cassandra/tools/NodeProbe.java |   23 +++++++++++++-
 2 files changed, 25 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/41ef1b55/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index feb6b5d..e7b7d9d 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,3 +1,7 @@
+0.8.9
+ * use cannonical host for local node in nodetool info (CASSANDRA-3556)
+
+
 0.8.8
  * avoid dropping tombstones when they might still be needed to shadow
    data in a different sstable (CASSANDRA-2786)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/41ef1b55/src/java/org/apache/cassandra/tools/NodeProbe.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/tools/NodeProbe.java b/src/java/org/apache/cassandra/tools/NodeProbe.java
index 59a6009..509dcb3 100644
--- a/src/java/org/apache/cassandra/tools/NodeProbe.java
+++ b/src/java/org/apache/cassandra/tools/NodeProbe.java
@@ -54,6 +54,7 @@ import org.apache.cassandra.service.StorageServiceMBean;
 import org.apache.cassandra.streaming.StreamingService;
 import org.apache.cassandra.streaming.StreamingServiceMBean;
 import org.apache.cassandra.thrift.UnavailableException;
+import org.apache.cassandra.utils.Pair;
 
 /**
  * JMX client operations for Cassandra.
@@ -518,11 +519,29 @@ public class NodeProbe
         return cfsProxy;
     }
 
+    public String getEndpoint()
+    {
+        // Try to find the endpoint using the local token, doing so in a crazy manner
+        // to maintain backwards compatibility with the MBean interface
+        String stringToken = ssProxy.getToken();
+        Map<Token, String> tokenToEndpoint = ssProxy.getTokenToEndpointMap();
+
+        for (Map.Entry<Token, String> pair : tokenToEndpoint.entrySet())
+        {
+            if (pair.getKey().toString().equals(stringToken))
+            {
+                return pair.getValue();
+            }
+        }
+
+        throw new AssertionError("Could not find myself in the endpoint list, something is
very wrong!");
+    }
+
     public String getDataCenter()
     {
         try
         {
-            return getEndpointSnitchInfoProxy().getDatacenter(host);
+            return getEndpointSnitchInfoProxy().getDatacenter(getEndpoint());
         }
         catch (UnknownHostException e)
         {
@@ -534,7 +553,7 @@ public class NodeProbe
     {
         try
         {
-            return getEndpointSnitchInfoProxy().getRack(host);
+            return getEndpointSnitchInfoProxy().getRack(getEndpoint());
         }
         catch (UnknownHostException e)
         {


Mime
View raw message