hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apurt...@apache.org
Subject svn commit: r720302 - in /hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver: HRegionServer.java metrics/RegionServerMetrics.java
Date Mon, 24 Nov 2008 21:49:25 GMT
Author: apurtell
Date: Mon Nov 24 13:49:25 2008
New Revision: 720302

URL: http://svn.apache.org/viewvc?rev=720302&view=rev
Log:
HBASE-1022 Add storefile index size to hbase metrics; add store count also

Modified:
    hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
    hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerMetrics.java

Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java?rev=720302&r1=720301&r2=720302&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java Mon
Nov 24 13:49:25 2008
@@ -652,21 +652,33 @@
     // 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?
+    int stores = 0;
     int storefiles = 0;
     long memcacheSize = 0;
+    long storefileIndexSize = 0;
     synchronized (this.onlineRegions) {
       for (Map.Entry<Integer, HRegion> e: this.onlineRegions.entrySet()) {
         HRegion r = e.getValue();
         memcacheSize += r.memcacheSize.get();
         synchronized(r.stores) {
+          stores += r.stores.size();
           for(Map.Entry<Integer, HStore> ee: r.stores.entrySet()) {
-            storefiles += ee.getValue().getStorefilesCount();
+            HStore store = ee.getValue(); 
+            storefiles += store.getStorefilesCount();
+            try {
+              storefileIndexSize += store.getStorefilesIndexSize();
+            } catch (IOException ex) {
+              LOG.warn("error getting store file index size for " + store +
+                ": " + StringUtils.stringifyException(ex));  
+            }
           }
         }
       }
     }
+    this.metrics.stores.set(stores);
     this.metrics.storefiles.set(storefiles);
     this.metrics.memcacheSizeMB.set((int)(memcacheSize/(1024*1024)));
+    this.metrics.storefileIndexSizeMB.set((int)(storefileIndexSize/(1024*1024)));
   }
 
   /**

Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerMetrics.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerMetrics.java?rev=720302&r1=720301&r2=720302&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerMetrics.java
(original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerMetrics.java
Mon Nov 24 13:49:25 2008
@@ -48,7 +48,12 @@
    * Count of requests to the regionservers since last call to metrics update
    */
   private final MetricsIntValue requests = new MetricsIntValue("requests");
-  
+
+  /**
+   * Count of stores open on the regionserver.
+   */
+  public final MetricsIntValue stores = new MetricsIntValue("stores");
+
   /**
    * Count of storefiles open on the regionserver.
    */
@@ -86,6 +91,7 @@
    */
   public void doUpdates(@SuppressWarnings("unused") MetricsContext unused) {
     synchronized (this) {
+      this.stores.pushMetric(this.metricsRecord);
       this.storefiles.pushMetric(this.metricsRecord);
       this.storefileIndexSizeMB.pushMetric(this.metricsRecord);
       this.memcacheSizeMB.pushMetric(this.metricsRecord);
@@ -131,6 +137,8 @@
     sb.append(this.requests.get()/seconds);
     sb.append(", regions=");
     sb.append(this.regions.get());
+    sb.append(", stores=");
+    sb.append(this.stores.get());
     sb.append(", storefiles=");
     sb.append(this.storefiles.get());
     sb.append(", storefileIndexSize=");



Mime
View raw message