hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From la...@apache.org
Subject hbase git commit: HBASE-12779 SplitTransaction: Add metrics.
Date Tue, 06 Jan 2015 01:18:51 GMT
Repository: hbase
Updated Branches:
  refs/heads/0.98 a89187119 -> 652da5404


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/652da540
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/652da540
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/652da540

Branch: refs/heads/0.98
Commit: 652da5404336e15064e12e2e278c68985ec25a3a
Parents: a891871
Author: Lars Hofhansl <larsh@apache.org>
Authored: Mon Jan 5 17:18:39 2015 -0800
Committer: Lars Hofhansl <larsh@apache.org>
Committed: Mon Jan 5 17:18:39 2015 -0800

----------------------------------------------------------------------
 .../regionserver/MetricsRegionServerSource.java    | 16 ++++++++++++++++
 .../regionserver/MetricsRegionServerWrapper.java   |  5 +++++
 .../MetricsRegionServerSourceImpl.java             | 15 +++++++++++++++
 .../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 +++++
 9 files changed, 79 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/652da540/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 2facb3b..45c9044 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/652da540/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 6ac3e2d..57c3e8d 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/652da540/hbase-hadoop1-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerSourceImpl.java
----------------------------------------------------------------------
diff --git a/hbase-hadoop1-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerSourceImpl.java
b/hbase-hadoop1-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerSourceImpl.java
index 5968efd..318624d 100644
--- a/hbase-hadoop1-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerSourceImpl.java
+++ b/hbase-hadoop1-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerSourceImpl.java
@@ -44,6 +44,8 @@ public class MetricsRegionServerSourceImpl
   private final MetricMutableCounterLong slowGet;
   private final MetricMutableCounterLong slowIncrement;
   private final MetricMutableCounterLong slowAppend;
+  private final MetricMutableCounterLong splitRequest;
+  private final MetricMutableCounterLong splitSuccess;
 
   private final MetricHistogram splitTimeHisto;
   private final MetricHistogram flushTimeHisto;
@@ -79,6 +81,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
@@ -137,6 +142,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);
   }

http://git-wip-us.apache.org/repos/asf/hbase/blob/652da540/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 c7b26b6..5c7c55b 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/652da540/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 96dc528..247370b 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
@@ -393,6 +393,9 @@ public class CompactSplitThread implements CompactionRequestor {
     return smallCompactions.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/652da540/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/652da540/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 af51332..784a4be 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
@@ -165,6 +165,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/652da540/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 b395f08..b6a305f 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
@@ -63,6 +63,7 @@ class SplitRequest implements Runnable {
       return;
     }
     boolean success = false;
+    server.getMetrics().incrSplitRequest();
     long startTime = EnvironmentEdgeManager.currentTimeMillis();
     SplitTransaction st = new SplitTransaction(parent, midKey);
     try {
@@ -129,6 +130,7 @@ class SplitRequest implements Runnable {
       // Update regionserver metrics with the split transaction total running time
       server.getMetrics().updateSplitTime(endTime - startTime);
       if (success) {
+        server.getMetrics().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/652da540/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 6502be1..2b651b8 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