cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sn...@apache.org
Subject [2/8] cassandra git commit: 'nodetool info' prints exception against older node
Date Thu, 12 Feb 2015 21:12:03 GMT
'nodetool info' prints exception against older node

Patch by Robert Stupp; Reviewed by Philip Thompson for CASSANDRA-8796


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

Branch: refs/heads/cassandra-2.1
Commit: b0b64fd3c6506a8dab89e6c53c36652d9cee7723
Parents: 9649594
Author: Robert Stupp <snazy@snazy.de>
Authored: Thu Feb 12 21:57:48 2015 +0100
Committer: Robert Stupp <snazy@snazy.de>
Committed: Thu Feb 12 21:57:48 2015 +0100

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 .../org/apache/cassandra/tools/NodeCmd.java     | 49 ++++++++++++++++----
 2 files changed, 41 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/b0b64fd3/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 861730f..aef3a1e 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -11,6 +11,7 @@
  * Round up time deltas lower than 1ms in BulkLoader (CASSANDRA-8645)
  * Add batch remove iterator to ABSC (CASSANDRA-8414, 8666)
  * Fix isClientMode check in Keyspace (CASSANDRA-8687)
+ * 'nodetool info' prints exception against older node (CASSANDRA-8796)
 
 
 2.0.12:

http://git-wip-us.apache.org/repos/asf/cassandra/blob/b0b64fd3/src/java/org/apache/cassandra/tools/NodeCmd.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/tools/NodeCmd.java b/src/java/org/apache/cassandra/tools/NodeCmd.java
index b085088..df53347 100644
--- a/src/java/org/apache/cassandra/tools/NodeCmd.java
+++ b/src/java/org/apache/cassandra/tools/NodeCmd.java
@@ -28,6 +28,7 @@ import java.util.*;
 import java.util.Map.Entry;
 import java.util.concurrent.ExecutionException;
 
+import javax.management.AttributeNotFoundException;
 import javax.management.openmbean.TabularData;
 
 import com.google.common.base.Joiner;
@@ -660,7 +661,16 @@ public class NodeCmd
         outs.printf("%-23s: %.2f / %.2f%n", "Heap Memory (MB)", memUsed, memMax);
 
         // Off heap memory usage
-        outs.printf("%-23s: %.2f%n", "Off Heap Memory (MB)", getOffHeapMemoryUsed());
+        try
+        {
+            outs.printf("%-23s: %.2f%n", "Off Heap Memory (MB)", getOffHeapMemoryUsed());
+        }
+        catch (RuntimeException e)
+        {
+            // offheap-metrics introduced in 2.1.3 - older versions do not have the appropriate
mbeans
+            if (!(e.getCause() instanceof AttributeNotFoundException))
+                throw e;
+        }
 
         // Data Center/Rack
         outs.printf("%-23s: %s%n", "Data Center", probe.getDataCenter());
@@ -977,15 +987,33 @@ public class NodeCmd
                     }
                 }
 
-                long bloomFilterOffHeapSize = cfstore.getBloomFilterOffHeapMemoryUsed();
-                long indexSummaryOffHeapSize = cfstore.getIndexSummaryOffHeapMemoryUsed();
-                long compressionMetadataOffHeapSize = cfstore.getCompressionMetadataOffHeapMemoryUsed();
+                boolean hasOffHeapSizes;
+                long bloomFilterOffHeapSize = 0L;
+                long indexSummaryOffHeapSize = 0L;
+                long compressionMetadataOffHeapSize = 0L;
+                long offHeapSize = 0L;
+                try
+                {
+                    bloomFilterOffHeapSize = cfstore.getBloomFilterOffHeapMemoryUsed();
+                    indexSummaryOffHeapSize = cfstore.getIndexSummaryOffHeapMemoryUsed();
+                    compressionMetadataOffHeapSize = cfstore.getCompressionMetadataOffHeapMemoryUsed();
 
-                long offHeapSize = bloomFilterOffHeapSize + indexSummaryOffHeapSize + compressionMetadataOffHeapSize;
+                    offHeapSize = bloomFilterOffHeapSize + indexSummaryOffHeapSize + compressionMetadataOffHeapSize;
+
+                    hasOffHeapSizes = true;
+                }
+                catch (RuntimeException e)
+                {
+                    // offheap-metrics introduced in 2.1.3 - older versions do not have the
appropriate mbeans
+                    if (!(e.getCause() instanceof AttributeNotFoundException))
+                        throw e;
+                    hasOffHeapSizes = false;
+                }
 
                 outs.println("\t\tSpace used (live), bytes: " + cfstore.getLiveDiskSpaceUsed());
                 outs.println("\t\tSpace used (total), bytes: " + cfstore.getTotalDiskSpaceUsed());
-                outs.println("\t\tOff heap memory used (total), bytes: " + offHeapSize);
+                if (hasOffHeapSizes)
+                    outs.println("\t\tOff heap memory used (total), bytes: " + offHeapSize);
                 outs.println("\t\tSSTable Compression Ratio: " + cfstore.getCompressionRatio());
                 outs.println("\t\tNumber of keys (estimate): " + cfstore.estimateKeys());
                 outs.println("\t\tMemtable cell count: " + cfstore.getMemtableColumnsCount());
@@ -999,9 +1027,12 @@ public class NodeCmd
                 outs.println("\t\tBloom filter false positives: " + cfstore.getBloomFilterFalsePositives());
                 outs.println("\t\tBloom filter false ratio: " + String.format("%01.5f", cfstore.getRecentBloomFilterFalseRatio()));
                 outs.println("\t\tBloom filter space used, bytes: " + cfstore.getBloomFilterDiskSpaceUsed());
-                outs.println("\t\tBloom filter off heap memory used, bytes: " + bloomFilterOffHeapSize);
-                outs.println("\t\tIndex summary off heap memory used, bytes: " + indexSummaryOffHeapSize);
-                outs.println("\t\tCompression metadata off heap memory used, bytes: " + compressionMetadataOffHeapSize);
+                if (hasOffHeapSizes)
+                {
+                    outs.println("\t\tBloom filter off heap memory used, bytes: " + bloomFilterOffHeapSize);
+                    outs.println("\t\tIndex summary off heap memory used, bytes: " + indexSummaryOffHeapSize);
+                    outs.println("\t\tCompression metadata off heap memory used, bytes: "
+ compressionMetadataOffHeapSize);
+                }
                 outs.println("\t\tCompacted partition minimum bytes: " + cfstore.getMinRowSize());
                 outs.println("\t\tCompacted partition maximum bytes: " + cfstore.getMaxRowSize());
                 outs.println("\t\tCompacted partition mean bytes: " + cfstore.getMeanRowSize());


Mime
View raw message