hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r1292139 - in /hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver: SplitRequest.java metrics/RegionServerMetrics.java
Date Wed, 22 Feb 2012 06:51:03 GMT
Author: stack
Date: Wed Feb 22 06:51:02 2012
New Revision: 1292139

URL: http://svn.apache.org/viewvc?rev=1292139&view=rev
Log:
HBASE-5189 Add metrics to keep track of region-splits in RS

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

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/SplitRequest.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/SplitRequest.java?rev=1292139&r1=1292138&r2=1292139&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/SplitRequest.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/SplitRequest.java Wed Feb
22 06:51:02 2012
@@ -65,6 +65,7 @@ class SplitRequest implements Runnable {
       if (!st.prepare()) return;
       try {
         st.execute(this.server, this.server);
+        this.server.getMetrics().incrementSplitSuccessCount();
       } catch (Exception e) {
         try {
           LOG.info("Running rollback/cleanup of failed split of " +
@@ -72,6 +73,7 @@ class SplitRequest implements Runnable {
           if (st.rollback(this.server, this.server)) {
             LOG.info("Successful rollback of failed split of " +
               parent.getRegionNameAsString());
+            this.server.getMetrics().incrementSplitFailureCount();
           } else {
             this.server.abort("Abort; we got an error after point-of-no-return");
           }
@@ -92,6 +94,7 @@ class SplitRequest implements Runnable {
     } catch (IOException ex) {
       LOG.error("Split failed " + this, RemoteExceptionHandler
           .checkIOException(ex));
+      this.server.getMetrics().incrementSplitFailureCount();
       server.checkFileSystem();
     }
   }

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerMetrics.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerMetrics.java?rev=1292139&r1=1292138&r2=1292139&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerMetrics.java
(original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerMetrics.java
Wed Feb 22 06:51:02 2012
@@ -38,6 +38,7 @@ import org.apache.hadoop.metrics.util.Me
 import org.apache.hadoop.metrics.util.MetricsLongValue;
 import org.apache.hadoop.metrics.util.MetricsRegistry;
 import org.apache.hadoop.metrics.util.MetricsTimeVaryingRate;
+import org.apache.hadoop.metrics.util.MetricsTimeVaryingLong;
 import org.apache.hadoop.util.StringUtils;
 
 import java.io.IOException;
@@ -238,6 +239,12 @@ public class RegionServerMetrics impleme
   
   public final MetricsTimeVaryingRate slowHLogAppendTime =
       new MetricsTimeVaryingRate("slowHLogAppendTime", registry);
+  
+  public final MetricsTimeVaryingLong regionSplitSuccessCount =
+      new MetricsTimeVaryingLong("regionSplitSuccessCount", registry);
+  
+  public final MetricsTimeVaryingLong regionSplitFailureCount =
+      new MetricsTimeVaryingLong("regionSplitFailureCount", registry);
 
   public RegionServerMetrics() {
     MetricsContext context = MetricsUtil.getContext("hbase");
@@ -354,6 +361,8 @@ public class RegionServerMetrics impleme
       this.flushTime.pushMetric(this.metricsRecord);
       this.flushSize.pushMetric(this.metricsRecord);
       this.slowHLogAppendCount.pushMetric(this.metricsRecord);
+      this.regionSplitSuccessCount.pushMetric(this.metricsRecord);
+      this.regionSplitFailureCount.pushMetric(this.metricsRecord);
     }
     this.metricsRecord.update();
   }
@@ -411,6 +420,14 @@ public class RegionServerMetrics impleme
   public void incrementRequests(final int inc) {
     this.requests.inc(inc);
   }
+  
+  public void incrementSplitSuccessCount() {
+    this.regionSplitSuccessCount.inc();
+  }
+  
+  public void incrementSplitFailureCount() {
+    this.regionSplitFailureCount.inc();
+  }
 
   @Override
   public String toString() {



Mime
View raw message