cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmcken...@apache.org
Subject [03/12] cassandra git commit: Fix DC and Rack in nodetool info
Date Thu, 24 Sep 2015 21:49:47 GMT
Fix DC and Rack in nodetool info

Patch by Carl Yeksigian; reviewed by stefania for CASSANDRA-10382


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

Branch: refs/heads/cassandra-2.2
Commit: 6039d0ef74a1d4c3333a699626302596d621ab04
Parents: 0c1432a
Author: Carl Yeksigian <carl@apache.org>
Authored: Thu Sep 24 14:43:44 2015 -0700
Committer: Joshua McKenzie <jmckenzie@apache.org>
Committed: Thu Sep 24 14:43:44 2015 -0700

----------------------------------------------------------------------
 src/java/org/apache/cassandra/service/StorageService.java | 10 +++++++++-
 .../org/apache/cassandra/service/StorageServiceMBean.java |  5 ++++-
 src/java/org/apache/cassandra/tools/NodeProbe.java        |  4 ++--
 3 files changed, 15 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/6039d0ef/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 ffe219e..8a2e71e 100644
--- a/src/java/org/apache/cassandra/service/StorageService.java
+++ b/src/java/org/apache/cassandra/service/StorageService.java
@@ -1416,7 +1416,7 @@ public class StorageService extends NotificationBroadcasterSupport implements
IE
         return getTokenMetadata().getHostId(FBUtilities.getBroadcastAddress()).toString();
     }
 
-    public Map<String, String> getHostIdMap()
+    public Map<String, String> getEndpointToHostId()
     {
         Map<String, String> mapOut = new HashMap<>();
         for (Map.Entry<InetAddress, UUID> entry : getTokenMetadata().getEndpointToHostIdMapForReading().entrySet())
@@ -1424,6 +1424,14 @@ public class StorageService extends NotificationBroadcasterSupport
implements IE
         return mapOut;
     }
 
+    public Map<String, String> getHostIdToEndpoint()
+    {
+        Map<String, String> mapOut = new HashMap<>();
+        for (Map.Entry<InetAddress, UUID> entry : getTokenMetadata().getEndpointToHostIdMapForReading().entrySet())
+            mapOut.put(entry.getValue().toString(), entry.getKey().getHostAddress());
+        return mapOut;
+    }
+
     /**
      * Construct the range to endpoint mapping based on the true view
      * of the world.

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6039d0ef/src/java/org/apache/cassandra/service/StorageServiceMBean.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/service/StorageServiceMBean.java b/src/java/org/apache/cassandra/service/StorageServiceMBean.java
index 1f86d82..7e74947 100644
--- a/src/java/org/apache/cassandra/service/StorageServiceMBean.java
+++ b/src/java/org/apache/cassandra/service/StorageServiceMBean.java
@@ -159,7 +159,10 @@ public interface StorageServiceMBean extends NotificationEmitter
     public String getLocalHostId();
 
     /** Retrieve the mapping of endpoint to host ID */
-    public Map<String, String> getHostIdMap();
+    public Map<String, String> getEndpointToHostId();
+
+    /** Retrieve the mapping of host ID to endpoint */
+    public Map<String, String> getHostIdToEndpoint();
 
     /**
      * Numeric load value.

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6039d0ef/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 caa12c3..6f2b6fb 100644
--- a/src/java/org/apache/cassandra/tools/NodeProbe.java
+++ b/src/java/org/apache/cassandra/tools/NodeProbe.java
@@ -502,7 +502,7 @@ public class NodeProbe implements AutoCloseable
 
     public Map<String, String> getHostIdMap()
     {
-        return ssProxy.getHostIdMap();
+        return ssProxy.getEndpointToHostId();
     }
 
     public String getLoadString()
@@ -807,7 +807,7 @@ public class NodeProbe implements AutoCloseable
 
     public String getEndpoint()
     {
-        Map<String, String> hostIdToEndpoint = ssProxy.getHostIdMap();
+        Map<String, String> hostIdToEndpoint = ssProxy.getHostIdToEndpoint();
         return hostIdToEndpoint.get(ssProxy.getLocalHostId());
     }
 


Mime
View raw message