You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by br...@apache.org on 2015/01/23 23:09:59 UTC

[1/3] cassandra git commit: fix ArrayIndexOutOfBoundsException in nodetool cfhistograms

Repository: cassandra
Updated Branches:
  refs/heads/cassandra-2.1 3a5f79eb5 -> c468c8b43
  refs/heads/trunk 27ad2db02 -> 230d884fa


fix ArrayIndexOutOfBoundsException in nodetool cfhistograms

Patch by Benjamin Lerer, reviewed by jbellis for CASSANDRA-8514


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

Branch: refs/heads/cassandra-2.1
Commit: c468c8b4369c76612a1fc821e8e77fe1da8b8011
Parents: 3a5f79e
Author: Brandon Williams <br...@apache.org>
Authored: Fri Jan 23 15:59:30 2015 -0600
Committer: Brandon Williams <br...@apache.org>
Committed: Fri Jan 23 15:59:30 2015 -0600

----------------------------------------------------------------------
 CHANGES.txt                                        |  1 +
 src/java/org/apache/cassandra/tools/NodeProbe.java | 12 +++++++++++-
 src/java/org/apache/cassandra/tools/NodeTool.java  | 14 ++++++++++++--
 3 files changed, 24 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/c468c8b4/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 474bfbe..7673a3b 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.1.3
+ * Fix ArrayIndexOutOfBoundsException in nodetool cfhistograms (CASSANDRA-8514)
  * Switch from yammer metrics for nodetool cf/proxy histograms (CASSANDRA-8662)
  * Make sure we don't add tmplink files to the compaction
    strategy (CASSANDRA-8580)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/c468c8b4/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 155236f..f124589 100644
--- a/src/java/org/apache/cassandra/tools/NodeProbe.java
+++ b/src/java/org/apache/cassandra/tools/NodeProbe.java
@@ -54,8 +54,11 @@ import org.apache.cassandra.utils.concurrent.SimpleCondition;
 import com.google.common.base.Function;
 import com.google.common.collect.*;
 import com.google.common.util.concurrent.Uninterruptibles;
+
 import com.yammer.metrics.reporting.JmxReporter;
 
+import static org.apache.commons.lang3.ArrayUtils.isEmpty;
+
 /**
  * JMX client operations for Cassandra.
  */
@@ -1152,10 +1155,17 @@ public class NodeProbe implements AutoCloseable
 
     public double[] metricPercentilesAsArray(long[] counts)
     {
+        double[] result = new double[7];
+
+        if (isEmpty(counts))
+        {
+            Arrays.fill(result, Double.NaN);
+            return result;
+        }
+
         double[] offsetPercentiles = new double[] { 0.5, 0.75, 0.95, 0.98, 0.99 };
         long[] offsets = new EstimatedHistogram(counts.length).getBucketOffsets();
         EstimatedHistogram metric = new EstimatedHistogram(offsets, counts);
-        double[] result = new double[7];
 
         if (metric.isOverflowed())
         {

http://git-wip-us.apache.org/repos/asf/cassandra/blob/c468c8b4/src/java/org/apache/cassandra/tools/NodeTool.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/tools/NodeTool.java b/src/java/org/apache/cassandra/tools/NodeTool.java
index 8de4fff..c2146c6 100644
--- a/src/java/org/apache/cassandra/tools/NodeTool.java
+++ b/src/java/org/apache/cassandra/tools/NodeTool.java
@@ -32,6 +32,7 @@ import javax.management.openmbean.*;
 import com.google.common.base.Joiner;
 import com.google.common.base.Throwables;
 import com.google.common.collect.*;
+
 import com.yammer.metrics.reporting.JmxReporter;
 
 import io.airlift.command.*;
@@ -62,6 +63,7 @@ import static com.google.common.collect.Lists.newArrayList;
 import static java.lang.Integer.parseInt;
 import static java.lang.String.format;
 import static org.apache.commons.lang3.ArrayUtils.EMPTY_STRING_ARRAY;
+import static org.apache.commons.lang3.ArrayUtils.isEmpty;
 import static org.apache.commons.lang3.StringUtils.*;
 
 public class NodeTool
@@ -1014,12 +1016,20 @@ public class NodeTool
 
             ColumnFamilyStoreMBean store = probe.getCfsProxy(keyspace, cfname);
 
+            long[] estimatedRowSizeHistogram = store.getEstimatedRowSizeHistogram();
+            long[] estimatedColumnCountHistogram = store.getEstimatedColumnCountHistogram();
+
+            if (isEmpty(estimatedRowSizeHistogram) || isEmpty(estimatedColumnCountHistogram))
+            {
+                System.err.println("No SSTables exists, unable to calculate 'Partition Size' and 'Cell Count' percentiles");
+            }
+
             // calculate percentile of row size and column count
             String[] percentiles = new String[]{"50%", "75%", "95%", "98%", "99%", "Min", "Max"};
             double[] readLatency = probe.metricPercentilesAsArray(store.getRecentReadLatencyHistogramMicros());
             double[] writeLatency = probe.metricPercentilesAsArray(store.getRecentWriteLatencyHistogramMicros());
-            double[] estimatedRowSizePercentiles = probe.metricPercentilesAsArray(store.getEstimatedRowSizeHistogram());
-            double[] estimatedColumnCountPercentiles = probe.metricPercentilesAsArray(store.getEstimatedColumnCountHistogram());
+            double[] estimatedRowSizePercentiles = probe.metricPercentilesAsArray(estimatedRowSizeHistogram);
+            double[] estimatedColumnCountPercentiles = probe.metricPercentilesAsArray(estimatedColumnCountHistogram);
             double[] sstablesPerRead = probe.metricPercentilesAsArray(store.getRecentSSTablesPerReadHistogram());
 
             System.out.println(format("%s/%s histograms", keyspace, cfname));


[3/3] cassandra git commit: Merge branch 'cassandra-2.1' into trunk

Posted by br...@apache.org.
Merge branch 'cassandra-2.1' into trunk


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

Branch: refs/heads/trunk
Commit: 230d884fa3a9505ec21b95ed84e7176aa1db4f9f
Parents: 27ad2db c468c8b
Author: Brandon Williams <br...@apache.org>
Authored: Fri Jan 23 16:09:54 2015 -0600
Committer: Brandon Williams <br...@apache.org>
Committed: Fri Jan 23 16:09:54 2015 -0600

----------------------------------------------------------------------

----------------------------------------------------------------------



[2/3] cassandra git commit: fix ArrayIndexOutOfBoundsException in nodetool cfhistograms

Posted by br...@apache.org.
fix ArrayIndexOutOfBoundsException in nodetool cfhistograms

Patch by Benjamin Lerer, reviewed by jbellis for CASSANDRA-8514


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

Branch: refs/heads/trunk
Commit: c468c8b4369c76612a1fc821e8e77fe1da8b8011
Parents: 3a5f79e
Author: Brandon Williams <br...@apache.org>
Authored: Fri Jan 23 15:59:30 2015 -0600
Committer: Brandon Williams <br...@apache.org>
Committed: Fri Jan 23 15:59:30 2015 -0600

----------------------------------------------------------------------
 CHANGES.txt                                        |  1 +
 src/java/org/apache/cassandra/tools/NodeProbe.java | 12 +++++++++++-
 src/java/org/apache/cassandra/tools/NodeTool.java  | 14 ++++++++++++--
 3 files changed, 24 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/c468c8b4/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 474bfbe..7673a3b 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.1.3
+ * Fix ArrayIndexOutOfBoundsException in nodetool cfhistograms (CASSANDRA-8514)
  * Switch from yammer metrics for nodetool cf/proxy histograms (CASSANDRA-8662)
  * Make sure we don't add tmplink files to the compaction
    strategy (CASSANDRA-8580)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/c468c8b4/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 155236f..f124589 100644
--- a/src/java/org/apache/cassandra/tools/NodeProbe.java
+++ b/src/java/org/apache/cassandra/tools/NodeProbe.java
@@ -54,8 +54,11 @@ import org.apache.cassandra.utils.concurrent.SimpleCondition;
 import com.google.common.base.Function;
 import com.google.common.collect.*;
 import com.google.common.util.concurrent.Uninterruptibles;
+
 import com.yammer.metrics.reporting.JmxReporter;
 
+import static org.apache.commons.lang3.ArrayUtils.isEmpty;
+
 /**
  * JMX client operations for Cassandra.
  */
@@ -1152,10 +1155,17 @@ public class NodeProbe implements AutoCloseable
 
     public double[] metricPercentilesAsArray(long[] counts)
     {
+        double[] result = new double[7];
+
+        if (isEmpty(counts))
+        {
+            Arrays.fill(result, Double.NaN);
+            return result;
+        }
+
         double[] offsetPercentiles = new double[] { 0.5, 0.75, 0.95, 0.98, 0.99 };
         long[] offsets = new EstimatedHistogram(counts.length).getBucketOffsets();
         EstimatedHistogram metric = new EstimatedHistogram(offsets, counts);
-        double[] result = new double[7];
 
         if (metric.isOverflowed())
         {

http://git-wip-us.apache.org/repos/asf/cassandra/blob/c468c8b4/src/java/org/apache/cassandra/tools/NodeTool.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/tools/NodeTool.java b/src/java/org/apache/cassandra/tools/NodeTool.java
index 8de4fff..c2146c6 100644
--- a/src/java/org/apache/cassandra/tools/NodeTool.java
+++ b/src/java/org/apache/cassandra/tools/NodeTool.java
@@ -32,6 +32,7 @@ import javax.management.openmbean.*;
 import com.google.common.base.Joiner;
 import com.google.common.base.Throwables;
 import com.google.common.collect.*;
+
 import com.yammer.metrics.reporting.JmxReporter;
 
 import io.airlift.command.*;
@@ -62,6 +63,7 @@ import static com.google.common.collect.Lists.newArrayList;
 import static java.lang.Integer.parseInt;
 import static java.lang.String.format;
 import static org.apache.commons.lang3.ArrayUtils.EMPTY_STRING_ARRAY;
+import static org.apache.commons.lang3.ArrayUtils.isEmpty;
 import static org.apache.commons.lang3.StringUtils.*;
 
 public class NodeTool
@@ -1014,12 +1016,20 @@ public class NodeTool
 
             ColumnFamilyStoreMBean store = probe.getCfsProxy(keyspace, cfname);
 
+            long[] estimatedRowSizeHistogram = store.getEstimatedRowSizeHistogram();
+            long[] estimatedColumnCountHistogram = store.getEstimatedColumnCountHistogram();
+
+            if (isEmpty(estimatedRowSizeHistogram) || isEmpty(estimatedColumnCountHistogram))
+            {
+                System.err.println("No SSTables exists, unable to calculate 'Partition Size' and 'Cell Count' percentiles");
+            }
+
             // calculate percentile of row size and column count
             String[] percentiles = new String[]{"50%", "75%", "95%", "98%", "99%", "Min", "Max"};
             double[] readLatency = probe.metricPercentilesAsArray(store.getRecentReadLatencyHistogramMicros());
             double[] writeLatency = probe.metricPercentilesAsArray(store.getRecentWriteLatencyHistogramMicros());
-            double[] estimatedRowSizePercentiles = probe.metricPercentilesAsArray(store.getEstimatedRowSizeHistogram());
-            double[] estimatedColumnCountPercentiles = probe.metricPercentilesAsArray(store.getEstimatedColumnCountHistogram());
+            double[] estimatedRowSizePercentiles = probe.metricPercentilesAsArray(estimatedRowSizeHistogram);
+            double[] estimatedColumnCountPercentiles = probe.metricPercentilesAsArray(estimatedColumnCountHistogram);
             double[] sstablesPerRead = probe.metricPercentilesAsArray(store.getRecentSSTablesPerReadHistogram());
 
             System.out.println(format("%s/%s histograms", keyspace, cfname));