hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r1099637 - in /hbase/branches/0.90: CHANGES.txt src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java src/main/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerMetrics.java
Date Wed, 04 May 2011 23:23:19 GMT
Author: stack
Date: Wed May  4 23:23:19 2011
New Revision: 1099637

URL: http://svn.apache.org/viewvc?rev=1099637&view=rev
Log:
HBASE-3848 request is always zero in WebUI for region server

Modified:
    hbase/branches/0.90/CHANGES.txt
    hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
    hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerMetrics.java

Modified: hbase/branches/0.90/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/branches/0.90/CHANGES.txt?rev=1099637&r1=1099636&r2=1099637&view=diff
==============================================================================
--- hbase/branches/0.90/CHANGES.txt (original)
+++ hbase/branches/0.90/CHANGES.txt Wed May  4 23:23:19 2011
@@ -40,6 +40,7 @@ Release 0.90.3 - Unreleased
                failures
    HBASE-3821  "NOT flushing memstore for region" keep on printing for half
                an hour (zhoushuaifeng)
+   HBASE-3848  request is always zero in WebUI for region server (gaojinchao)
 
   IMPROVEMENT
    HBASE-3717  deprecate HTable isTableEnabled() methods in favor of HBaseAdmin

Modified: hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java?rev=1099637&r1=1099636&r2=1099637&view=diff
==============================================================================
--- hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
(original)
+++ hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
Wed May  4 23:23:19 2011
@@ -1141,8 +1141,12 @@ public class HRegionServer implements HR
   }
 
   protected void metrics() {
+    int seconds = this.msgInterval / 1000;
+    if(0 == seconds){
+       seconds = 1;
+    }
     this.metrics.regions.set(this.onlineRegions.size());
-    this.metrics.incrementRequests(this.requestCount.get());
+    this.metrics.requests.set(this.requestCount.get()/seconds);
     // Is this too expensive every three seconds getting a lock on onlineRegions
     // and then per store carried? Can I make metrics be sloppier and avoid
     // the synchronizations?

Modified: hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerMetrics.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerMetrics.java?rev=1099637&r1=1099636&r2=1099637&view=diff
==============================================================================
--- hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerMetrics.java
(original)
+++ hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerMetrics.java
Wed May  4 23:23:19 2011
@@ -23,7 +23,6 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.hbase.io.hfile.HFile;
 import org.apache.hadoop.hbase.metrics.HBaseInfo;
-import org.apache.hadoop.hbase.metrics.MetricsRate;
 import org.apache.hadoop.hbase.metrics.PersistentMetricsTimeVaryingRate;
 import org.apache.hadoop.hbase.regionserver.wal.HLog;
 import org.apache.hadoop.hbase.util.Pair;
@@ -112,10 +111,10 @@ public class RegionServerMetrics impleme
    */
   public final MetricsIntValue blockCacheHitCachingRatio = new MetricsIntValue("blockCacheHitCachingRatio",
registry);
 
-  /*
+  /**
    * Count of requests to the regionservers since last call to metrics update
    */
-  private final MetricsRate requests = new MetricsRate("requests", registry);
+  public final MetricsIntValue requests = new MetricsIntValue("requests", registry);
 
   /**
    * Count of stores open on the regionserver.
@@ -295,13 +294,6 @@ public class RegionServerMetrics impleme
   }
 
   /**
-   * @return Count of requests.
-   */
-  public float getRequests() {
-    return this.requests.getPreviousIntervalValue();
-  }
-
-  /**
    * @param compact history in <time, size>
    */
   public synchronized void addCompaction(final Pair<Long,Long> compact) {
@@ -319,12 +311,6 @@ public class RegionServerMetrics impleme
     }
   }
 
-  /**
-   * @param inc How much to add to requests.
-   */
-  public void incrementRequests(final int inc) {
-    this.requests.inc(inc);
-  }
 
   @Override
   public String toString() {
@@ -333,8 +319,8 @@ public class RegionServerMetrics impleme
     if (seconds == 0) {
       seconds = 1;
     }
-    sb = Strings.appendKeyValue(sb, "request",
-      Float.valueOf(this.requests.getPreviousIntervalValue()));
+    sb = Strings.appendKeyValue(sb, "requests",
+        Integer.valueOf(this.requests.get()));
     sb = Strings.appendKeyValue(sb, "regions",
       Integer.valueOf(this.regions.get()));
     sb = Strings.appendKeyValue(sb, "stores",



Mime
View raw message