HBASE-15683 Min latency in latency histograms are emitted as Long.MAX_VALUE


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

Branch: refs/heads/branch-1
Commit: 1e6d7e811dd02067d814b551b0a556254cd90671
Parents: 5d497d5
Author: Enis Soztutar <e...@apache.org>
Authored: Thu Apr 21 10:44:03 2016 -0700
Committer: Enis Soztutar <e...@apache.org>
Committed: Thu Apr 21 10:44:08 2016 -0700

----------------------------------------------------------------------
 .../org/apache/hadoop/hbase/util/FastLongHistogram.java     | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/1e6d7e81/hbase-common/src/main/java/org/apache/hadoop/hbase/util/FastLongHistogram.java
----------------------------------------------------------------------
diff --git 
a/hbase-common/src/main/java/org/apache/hadoop/hbase/util/FastLongHistogram.java
 
b/hbase-common/src/main/java/org/apache/hadoop/hbase/util/FastLongHistogram.java
index 9b403d9..3c4eccc 100644
--- 
a/hbase-common/src/main/java/org/apache/hadoop/hbase/util/FastLongHistogram.java
+++ 
b/hbase-common/src/main/java/org/apache/hadoop/hbase/util/FastLongHistogram.java
@@ -58,7 +58,7 @@ public class FastLongHistogram {
     // set to true when any of data has been inserted to the Bins. It is set 
after the counts are
     // updated.
     private final AtomicBoolean hasData = new AtomicBoolean(false);
-    
+
     /**
      * The constructor for creating a Bins without any prior data.
      */
@@ -134,7 +134,7 @@ public class FastLongHistogram {
       // hasData needs to be updated as last
       this.hasData.set(true);
     }
-    
+
     /**
      * Computes the quantiles give the ratios.
      */
@@ -157,7 +157,7 @@ public class FastLongHistogram {
       int rIndex = 0;
       double qCount = total * quantiles[0];
       long cum = 0L;
-      
+
       long[] res = new long[quantiles.length];
       countsLoop: for (int i = 0; i < counts.length; i++) {
         // mn and mx define a value range
@@ -281,7 +281,8 @@ public class FastLongHistogram {
   }
 
   public long getMin() {
-    return this.bins.min.get();
+    long min = this.bins.min.get();
+    return min == Long.MAX_VALUE ? 0 : min; // in case it is not initialized
   }
 
   public long getMax() {

Reply via email to