hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From la...@apache.org
Subject [2/3] hbase git commit: HBASE-12779 SplitTransaction: Add metrics.
Date Tue, 06 Jan 2015 01:16:23 GMT
HBASE-12779 SplitTransaction: Add metrics.


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

Branch: refs/heads/branch-1
Commit: e491f337f1092d2c826ede24fcb975be146f38df
Parents: 0de113e
Author: Lars Hofhansl <larsh@apache.org>
Authored: Mon Jan 5 17:13:58 2015 -0800
Committer: Lars Hofhansl <larsh@apache.org>
Committed: Mon Jan 5 17:14:20 2015 -0800

----------------------------------------------------------------------
 .../regionserver/MetricsRegionServerSource.java    | 16 ++++++++++++++++
 .../regionserver/MetricsRegionServerWrapper.java   |  5 +++++
 .../MetricsRegionServerSourceImpl.java             | 17 +++++++++++++++++
 .../hbase/regionserver/CompactSplitThread.java     |  3 +++
 .../hbase/regionserver/MetricsRegionServer.java    |  8 ++++++++
 .../MetricsRegionServerWrapperImpl.java            |  8 ++++++++
 .../hadoop/hbase/regionserver/SplitRequest.java    |  2 ++
 .../MetricsRegionServerWrapperStub.java            |  5 +++++
 8 files changed, 64 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/e491f337/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerSource.java
----------------------------------------------------------------------
diff --git a/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerSource.java
b/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerSource.java
index c64cc88..702acae 100644
--- a/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerSource.java
+++ b/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerSource.java
@@ -119,6 +119,16 @@ public interface MetricsRegionServerSource extends BaseSource {
   void updateSplitTime(long t);
 
   /**
+   * Increment number of a requested splits
+   */
+  void incrSplitRequest();
+
+  /**
+   * Increment number of successful splits
+   */
+  void incrSplitSuccess();
+
+  /**
    * Update the flush time histogram
    * @param t time it took, in milliseconds
    */
@@ -170,6 +180,8 @@ public interface MetricsRegionServerSource extends BaseSource {
   String PERCENT_FILES_LOCAL = "percentFilesLocal";
   String PERCENT_FILES_LOCAL_DESC =
       "The percent of HFiles that are stored on the local hdfs data node.";
+  String SPLIT_QUEUE_LENGTH = "splitQueueLength";
+  String SPLIT_QUEUE_LENGTH_DESC = "Length of the queue for splits.";
   String COMPACTION_QUEUE_LENGTH = "compactionQueueLength";
   String LARGE_COMPACTION_QUEUE_LENGTH = "largeCompactionQueueLength";
   String SMALL_COMPACTION_QUEUE_LENGTH = "smallCompactionQueueLength";
@@ -251,5 +263,9 @@ public interface MetricsRegionServerSource extends BaseSource {
       + "larger than blockingMemStoreSize";
 
   String SPLIT_KEY = "splitTime";
+  String SPLIT_REQUEST_KEY = "splitRequestCount";
+  String SPLIT_REQUEST_DESC = "Number of splits requested";
+  String SPLIT_SUCCESS_KEY = "splitSuccessCounnt";
+  String SPLIT_SUCCESS_DESC = "Number of successfully executed splits";
   String FLUSH_KEY = "flushTime";
 }

http://git-wip-us.apache.org/repos/asf/hbase/blob/e491f337/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerWrapper.java
----------------------------------------------------------------------
diff --git a/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerWrapper.java
b/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerWrapper.java
index dea2440..dbf93d0 100644
--- a/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerWrapper.java
+++ b/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerWrapper.java
@@ -154,6 +154,11 @@ public interface MetricsRegionServerWrapper {
   int getPercentFileLocal();
 
   /**
+   * Get the size of the split queue
+   */
+  int getSplitQueueSize();
+
+  /**
    * Get the size of the compaction queue
    */
   int getCompactionQueueSize();

http://git-wip-us.apache.org/repos/asf/hbase/blob/e491f337/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerSourceImpl.java
----------------------------------------------------------------------
diff --git a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerSourceImpl.java
b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerSourceImpl.java
index cb12aa1..7b55acc 100644
--- a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerSourceImpl.java
+++ b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerSourceImpl.java
@@ -48,6 +48,8 @@ public class MetricsRegionServerSourceImpl
   private final MutableCounterLong slowGet;
   private final MutableCounterLong slowIncrement;
   private final MutableCounterLong slowAppend;
+  private final MutableCounterLong splitRequest;
+  private final MutableCounterLong splitSuccess;
 
   private final MetricHistogram splitTimeHisto;
   private final MetricHistogram flushTimeHisto;
@@ -83,6 +85,9 @@ public class MetricsRegionServerSourceImpl
 
     splitTimeHisto = getMetricsRegistry().newHistogram(SPLIT_KEY);
     flushTimeHisto = getMetricsRegistry().newHistogram(FLUSH_KEY);
+
+    splitRequest = getMetricsRegistry().newCounter(SPLIT_REQUEST_KEY, SPLIT_REQUEST_DESC,
0l);
+    splitSuccess = getMetricsRegistry().newCounter(SPLIT_SUCCESS_KEY, SPLIT_SUCCESS_DESC,
0l);
   }
 
   @Override
@@ -141,6 +146,16 @@ public class MetricsRegionServerSourceImpl
   }
 
   @Override
+  public void incrSplitRequest() {
+    splitRequest.incr();
+  }
+
+  @Override
+  public void incrSplitSuccess() {
+    splitSuccess.incr();
+  }
+
+  @Override
   public void updateSplitTime(long t) {
     splitTimeHisto.add(t);
   }
@@ -198,6 +213,8 @@ public class MetricsRegionServerSourceImpl
               rsWrap.getDataInMemoryWithoutWAL())
           .addGauge(Interns.info(PERCENT_FILES_LOCAL, PERCENT_FILES_LOCAL_DESC),
               rsWrap.getPercentFileLocal())
+          .addGauge(Interns.info(SPLIT_QUEUE_LENGTH, SPLIT_QUEUE_LENGTH_DESC),
+              rsWrap.getSplitQueueSize())
           .addGauge(Interns.info(COMPACTION_QUEUE_LENGTH, COMPACTION_QUEUE_LENGTH_DESC),
               rsWrap.getCompactionQueueSize())
           .addGauge(Interns.info(FLUSH_QUEUE_LENGTH, FLUSH_QUEUE_LENGTH_DESC),

http://git-wip-us.apache.org/repos/asf/hbase/blob/e491f337/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CompactSplitThread.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CompactSplitThread.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CompactSplitThread.java
index 1badd39..ea9f971 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CompactSplitThread.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/CompactSplitThread.java
@@ -413,6 +413,9 @@ public class CompactSplitThread implements CompactionRequestor, PropagatingConfi
     return shortCompactions.getQueue().size();
   }
 
+  public int getSplitQueueSize() {
+    return splits.getQueue().size();
+  }
 
   private boolean shouldSplitRegion() {
     return (regionSplitLimit > server.getNumberOfOnlineRegions());

http://git-wip-us.apache.org/repos/asf/hbase/blob/e491f337/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServer.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServer.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServer.java
index 4596edc..c3bf97e 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServer.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServer.java
@@ -99,6 +99,14 @@ public class MetricsRegionServer {
     serverSource.updateSplitTime(t);
   }
 
+  public void incrSplitRequest() {
+    serverSource.incrSplitRequest();
+  }
+
+  public void incrSplitSuccess() {
+    serverSource.incrSplitSuccess();
+  }
+
   public void updateFlushTime(long t) {
     serverSource.updateFlushTime(t);
   }

http://git-wip-us.apache.org/repos/asf/hbase/blob/e491f337/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerWrapperImpl.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerWrapperImpl.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerWrapperImpl.java
index 415e271..4aa6789 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerWrapperImpl.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerWrapperImpl.java
@@ -166,6 +166,14 @@ class MetricsRegionServerWrapperImpl
   }
 
   @Override
+  public int getSplitQueueSize() {
+    if (this.regionServer.compactSplitThread == null) {
+      return 0;
+    }
+    return this.regionServer.compactSplitThread.getSplitQueueSize();
+  }
+
+  @Override
   public int getCompactionQueueSize() {
     //The thread could be zero.  if so assume there is no queue.
     if (this.regionServer.compactSplitThread == null) {

http://git-wip-us.apache.org/repos/asf/hbase/blob/e491f337/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/SplitRequest.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/SplitRequest.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/SplitRequest.java
index a96f563..928a9f6 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/SplitRequest.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/SplitRequest.java
@@ -62,6 +62,7 @@ class SplitRequest implements Runnable {
       return;
     }
     boolean success = false;
+    server.metricsRegionServer.incrSplitRequest();
     long startTime = EnvironmentEdgeManager.currentTime();
     SplitTransaction st = new SplitTransaction(parent, midKey);
     try {
@@ -128,6 +129,7 @@ class SplitRequest implements Runnable {
       // Update regionserver metrics with the split transaction total running time
       server.metricsRegionServer.updateSplitTime(endTime - startTime);
       if (success) {
+        server.metricsRegionServer.incrSplitSuccess();
         // Log success
         LOG.info("Region split, hbase:meta updated, and report to master. Parent="
             + parent.getRegionNameAsString() + ", new regions: "

http://git-wip-us.apache.org/repos/asf/hbase/blob/e491f337/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerWrapperStub.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerWrapperStub.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerWrapperStub.java
index cd22d86..f55891d 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerWrapperStub.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerWrapperStub.java
@@ -245,4 +245,9 @@ public class MetricsRegionServerWrapperStub implements MetricsRegionServerWrappe
   public long getBlockedRequestsCount() {
     return 0;
   }
+
+  @Override
+  public int getSplitQueueSize() {
+    return 0;
+  }
 }


Mime
View raw message