cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yu...@apache.org
Subject [01/15] cassandra git commit: Backport CASSANDRA-10859
Date Wed, 30 Mar 2016 21:52:32 GMT
Repository: cassandra
Updated Branches:
  refs/heads/cassandra-2.1 5a45aa62d -> 105fbb35d
  refs/heads/cassandra-2.2 6ff006554 -> 1dac59d1e
  refs/heads/cassandra-3.0 500d6b3a2 -> 202786e06
  refs/heads/cassandra-3.5 9b1968fcb -> 7fbdce812
  refs/heads/trunk 7f6d70d70 -> d00bda88b


Backport CASSANDRA-10859

patch by yukim; reviewed by thobbs for CASSANDRA-11415


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

Branch: refs/heads/cassandra-2.1
Commit: 105fbb35db228aa47b7de079795d61e748ed8abc
Parents: 5a45aa6
Author: Yuki Morishita <yukim@apache.org>
Authored: Wed Mar 23 14:53:39 2016 -0500
Committer: Yuki Morishita <yukim@apache.org>
Committed: Wed Mar 30 16:47:42 2016 -0500

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 .../org/apache/cassandra/tools/NodeProbe.java   |  5 ++---
 .../cassandra/utils/EstimatedHistogram.java     | 20 ++++++++++++++++++++
 3 files changed, 23 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/105fbb35/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 65d094f..af2518c 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.1.14
+ * Backport CASSANDRA-10859 (CASSANDRA-11415)
  * COPY FROM fails when importing blob (CASSANDRA-11375)
  * Backport CASSANDRA-10679 (CASSANDRA-9598)
  * Don't do defragmentation if reading from repaired sstables (CASSANDRA-10342)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/105fbb35/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 ab08e9f..13c7acf 100644
--- a/src/java/org/apache/cassandra/tools/NodeProbe.java
+++ b/src/java/org/apache/cassandra/tools/NodeProbe.java
@@ -1265,13 +1265,12 @@ public class NodeProbe implements AutoCloseable
         }
 
         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);
+        EstimatedHistogram metric = new EstimatedHistogram(counts);
 
         if (metric.isOverflowed())
         {
             System.err.println(String.format("EstimatedHistogram overflowed larger than %s,
unable to calculate percentiles",
-                                             offsets[offsets.length - 1]));
+                                             metric.getLargestBucketOffset()));
             for (int i = 0; i < result.length; i++)
                 result[i] = Double.NaN;
         }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/105fbb35/src/java/org/apache/cassandra/utils/EstimatedHistogram.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/utils/EstimatedHistogram.java b/src/java/org/apache/cassandra/utils/EstimatedHistogram.java
index a5c51c8..fd22f6f 100644
--- a/src/java/org/apache/cassandra/utils/EstimatedHistogram.java
+++ b/src/java/org/apache/cassandra/utils/EstimatedHistogram.java
@@ -68,6 +68,18 @@ public class EstimatedHistogram
         buckets = new AtomicLongArray(bucketData);
     }
 
+    /**
+     * Create EstimatedHistogram from only bucket data.
+     *
+     * @param bucketData bucket data
+     */
+    public EstimatedHistogram(long[] bucketData)
+    {
+        assert bucketData != null && bucketData.length > 0 : "Bucket data must
be an array of size more than 0";
+        bucketOffsets = newOffsets(bucketData.length - 1);
+        buckets = new AtomicLongArray(bucketData);
+    }
+
     private static long[] newOffsets(int size)
     {
         long[] result = new long[size];
@@ -226,6 +238,14 @@ public class EstimatedHistogram
     }
 
     /**
+     * @return the largest bucket offset
+     */
+    public long getLargestBucketOffset()
+    {
+        return bucketOffsets[bucketOffsets.length - 1];
+    }
+
+    /**
      * @return true if this histogram has overflowed -- that is, a value larger than our
largest bucket could bound was added
      */
     public boolean isOverflowed()


Mime
View raw message