cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject [4/6] git commit: fix nodetool ownership display with vnodes patch by jbellis; reviewed by yukim for CASSANDRA-5065
Date Tue, 18 Dec 2012 20:32:36 GMT
fix nodetool ownership display with vnodes
patch by jbellis; reviewed by yukim for CASSANDRA-5065


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

Branch: refs/heads/trunk
Commit: d67816bee5271a4f65116561950bbd2b6fcf51a4
Parents: bc598b5
Author: Jonathan Ellis <jbellis@apache.org>
Authored: Tue Dec 18 14:32:07 2012 -0600
Committer: Jonathan Ellis <jbellis@apache.org>
Committed: Tue Dec 18 14:32:13 2012 -0600

----------------------------------------------------------------------
 CHANGES.txt                                        |    1 +
 .../apache/cassandra/service/StorageService.java   |   18 ++++++++------
 2 files changed, 11 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/d67816be/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 4a13a7c..2e789fa 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 1.2.0-rc2
+ * fix nodetool ownership display with vnodes (CASSANDRA-5065)
  * cqlsh: add DESCRIBE KEYSPACES command (CASSANDRA-5060)
  * Fix potential infinite loop when reloading CFS (CASSANDRA-5064)
  * Fix SimpleAuthorizer example (CASSANDRA-5072)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/d67816be/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 5577680..9cddc1a 100644
--- a/src/java/org/apache/cassandra/service/StorageService.java
+++ b/src/java/org/apache/cassandra/service/StorageService.java
@@ -3207,20 +3207,22 @@ public class StorageService implements IEndpointStateChangeSubscriber,
StorageSe
         }
     }
 
-    public boolean isDcAwareReplicationStrategy(String keyspace)
-    {
-        return SimpleStrategy.class != Table.open(keyspace).getReplicationStrategy().getClass();
-    }
-
     public Map<InetAddress, Float> getOwnership()
     {
         List<Token> sortedTokens = tokenMetadata.sortedTokens();
         // describeOwnership returns tokens in an unspecified order, let's re-order them
         Map<Token, Float> tokenMap = new TreeMap<Token, Float>(getPartitioner().describeOwnership(sortedTokens));
-        Map<InetAddress, Float> stringMap = new LinkedHashMap<InetAddress, Float>();
+        Map<InetAddress, Float> nodeMap = new LinkedHashMap<InetAddress, Float>();
         for (Map.Entry<Token, Float> entry : tokenMap.entrySet())
-            stringMap.put(tokenMetadata.getEndpoint(entry.getKey()), entry.getValue());
-        return stringMap;
+        {
+            InetAddress endpoint = tokenMetadata.getEndpoint(entry.getKey());
+            Float tokenOwnership = entry.getValue();
+            if (nodeMap.containsKey(endpoint))
+                nodeMap.put(endpoint, nodeMap.get(endpoint) + tokenOwnership);
+            else
+                nodeMap.put(endpoint, tokenOwnership);
+        }
+        return nodeMap;
     }
 
     /**


Mime
View raw message