hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From li...@apache.org
Subject svn commit: r1470795 - in /hbase/branches/0.89-fb/src: main/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerMetrics.java test/java/org/apache/hadoop/hbase/util/HistogramTest.java
Date Tue, 23 Apr 2013 02:50:12 GMT
Author: liyin
Date: Tue Apr 23 02:50:12 2013
New Revision: 1470795

URL: http://svn.apache.org/r1470795
Log:
[HBASE-8307] Fixing the test in Histogram metrics.

Author: manukranthk

Summary: testAboveMaxValue looks exactly like the same as the testBelowMaxValuetest but needs
to put values above the max value.

Test Plan: Tested on shadow.

Reviewers: rshroff, gauravm

Reviewed By: rshroff

Differential Revision: https://phabricator.fb.com/D780992

Modified:
    hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerMetrics.java
    hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/util/HistogramTest.java

Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerMetrics.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerMetrics.java?rev=1470795&r1=1470794&r2=1470795&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerMetrics.java
(original)
+++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerMetrics.java
Tue Apr 23 02:50:12 2013
@@ -351,11 +351,6 @@ public class RegionServerMetrics impleme
         this.lastExtUpdate = this.lastUpdate;
         this.resetAllMinMax();
       }
-      if (this.histogramMetricWindow > 0 &&
-        ((this.lastUpdate - this.lastHistUpdate) >= this.histogramMetricWindow)) {
-        this.lastHistUpdate = this.lastUpdate;
-        this.resetAllHistogramBasedMetrics();
-      }
 
       this.stores.pushMetric(this.metricsRecord);
       this.storefiles.pushMetric(this.metricsRecord);
@@ -457,6 +452,12 @@ public class RegionServerMetrics impleme
       this.quorumReadsExecutedInCurThread.pushMetric(this.metricsRecord);
 
       this.blocksCachedDuringCompaction.pushMetric(this.metricsRecord);
+
+      if (this.histogramMetricWindow > 0 &&
+        ((this.lastUpdate - this.lastHistUpdate) >= this.histogramMetricWindow)) {
+        this.lastHistUpdate = this.lastUpdate;
+        this.resetAllHistogramBasedMetrics();
+      }
     }
     this.metricsRecord.update();
   }

Modified: hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/util/HistogramTest.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/util/HistogramTest.java?rev=1470795&r1=1470794&r2=1470795&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/util/HistogramTest.java (original)
+++ hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/util/HistogramTest.java Tue
Apr 23 02:50:12 2013
@@ -25,13 +25,14 @@ public class HistogramTest extends TestC
 
   @Test
   public void testAboveMaxValue() {
-    Histogram hist = new Histogram(1000, 100.0, 10000.0);
+    Double hi = 10000.0;
+    Histogram hist = new Histogram(1000, 100.0, hi);
     for (int i=0; i<100; i++) {
-      Double tmp = i * 1.0;
+      Double tmp = hi + i * 1.0;
       hist.addValue(tmp);
     }
     Double prcntyl = hist.getPercentileEstimate(95.0);
-    assertTrue(prcntyl >= 94 && prcntyl <= 96);
+    assertTrue(prcntyl >= (hi + 94) && prcntyl <= (hi + 96));
   }
   @Test
   public void testBelowMinValue() {



Mime
View raw message