cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gdusba...@apache.org
Subject svn commit: r980492 - /cassandra/trunk/src/java/org/apache/cassandra/tools/NodeCmd.java
Date Thu, 29 Jul 2010 15:58:29 GMT
Author: gdusbabek
Date: Thu Jul 29 15:58:29 2010
New Revision: 980492

URL: http://svn.apache.org/viewvc?rev=980492&view=rev
Log:
print a more friendly error when printRing gets IllegalState. Patch by Nate McCall, reviewed
by Gary Dusbabek. CASSANDRA-1310

Modified:
    cassandra/trunk/src/java/org/apache/cassandra/tools/NodeCmd.java

Modified: cassandra/trunk/src/java/org/apache/cassandra/tools/NodeCmd.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/tools/NodeCmd.java?rev=980492&r1=980491&r2=980492&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/tools/NodeCmd.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/tools/NodeCmd.java Thu Jul 29 15:58:29 2010
@@ -91,13 +91,20 @@ public class NodeCmd {
      */
     public void printRing(PrintStream outs)
     {
-        Map<Range, List<String>> rangeMap = probe.getRangeToEndpointMap(null);
-        Map<Range, List<String>> pendingRangeMap = probe.getPendingRangeToEndpoingMap(null);
+        
         Map<Range, List<String>> rangesToIterate = new HashMap<Range, List<String>>();
-
-        rangesToIterate.putAll(pendingRangeMap);
-        rangesToIterate.putAll(rangeMap);
-
+        try
+        {
+            rangesToIterate.putAll(probe.getPendingRangeToEndpoingMap(null));
+            rangesToIterate.putAll(probe.getRangeToEndpointMap(null));
+        } 
+        catch (IllegalStateException ise) 
+        {
+            outs.println(String.format("Ring information unavailable: %s",ise.getMessage()));
+            return;
+        }
+        
+        
         List<Range> ranges = new ArrayList<Range>(rangesToIterate.keySet());
         Collections.sort(ranges);
         Set<String> liveNodes = probe.getLiveNodes();



Mime
View raw message