hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From syuanji...@apache.org
Subject [32/50] [abbrv] hbase git commit: HBASE-13857 Slow WAL Append count in ServerMetricsTmpl.jamon is hardcoded to zero (Vrishal Kulkarni)
Date Mon, 07 Dec 2015 16:56:09 GMT
HBASE-13857 Slow WAL Append count in ServerMetricsTmpl.jamon is hardcoded to zero (Vrishal
Kulkarni)


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

Branch: refs/heads/hbase-12439
Commit: 51503efcf05be734c14200233d5f1495e4c2c3f1
Parents: 67ba659
Author: stack <stack@apache.org>
Authored: Thu Dec 3 17:00:29 2015 -0800
Committer: stack <stack@apache.org>
Committed: Thu Dec 3 17:00:29 2015 -0800

----------------------------------------------------------------------
 .../hbase/regionserver/MetricsRegionServerWrapper.java | 13 +++++++++----
 .../hbase/regionserver/wal/MetricsWALSource.java       |  1 +
 .../hbase/regionserver/wal/MetricsWALSourceImpl.java   |  5 +++++
 .../hbase/tmpl/regionserver/ServerMetricsTmpl.jamon    |  2 +-
 .../regionserver/MetricsRegionServerWrapperImpl.java   |  8 ++++++++
 .../regionserver/MetricsRegionServerWrapperStub.java   |  5 +++++
 .../hadoop/hbase/regionserver/wal/TestMetricsWAL.java  | 13 +++++++++++++
 7 files changed, 42 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/51503efc/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 6921222..02dec8d 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
@@ -70,16 +70,21 @@ public interface MetricsRegionServerWrapper {
   /**
    * Get the number of WAL files of this region server.
    */
-  public long getNumWALFiles();
+  long getNumWALFiles();
   
   /**
    * Get the size of WAL files of this region server.
    */
-  public long getWALFileSize();
-  
+  long getWALFileSize();
+
   /**
-   * Get the number of store files hosted on this region server.
+   * Get the number of WAL files with slow appends for this region server.
    */
+  long getNumWALSlowAppend();
+
+    /**
+     * Get the number of store files hosted on this region server.
+     */
   long getNumStoreFiles();
 
   /**

http://git-wip-us.apache.org/repos/asf/hbase/blob/51503efc/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/regionserver/wal/MetricsWALSource.java
----------------------------------------------------------------------
diff --git a/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/regionserver/wal/MetricsWALSource.java
b/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/regionserver/wal/MetricsWALSource.java
index f8c746f..c6dc731 100644
--- a/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/regionserver/wal/MetricsWALSource.java
+++ b/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/regionserver/wal/MetricsWALSource.java
@@ -92,4 +92,5 @@ public interface MetricsWALSource extends BaseSource {
 
   void incrementLowReplicationLogRoll();
 
+  long getSlowAppendCount();
 }

http://git-wip-us.apache.org/repos/asf/hbase/blob/51503efc/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/regionserver/wal/MetricsWALSourceImpl.java
----------------------------------------------------------------------
diff --git a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/regionserver/wal/MetricsWALSourceImpl.java
b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/regionserver/wal/MetricsWALSourceImpl.java
index 36c3571..7583780 100644
--- a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/regionserver/wal/MetricsWALSourceImpl.java
+++ b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/regionserver/wal/MetricsWALSourceImpl.java
@@ -98,4 +98,9 @@ public class MetricsWALSourceImpl extends BaseSourceImpl implements MetricsWALSo
   public void incrementLowReplicationLogRoll() {
     lowReplicationLogRollRequested.incr();
   }
+
+  @Override
+  public long getSlowAppendCount() {
+    return slowAppendCount.value();
+  }
 }

http://git-wip-us.apache.org/repos/asf/hbase/blob/51503efc/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/ServerMetricsTmpl.jamon
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/ServerMetricsTmpl.jamon
b/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/ServerMetricsTmpl.jamon
index a86a4ea..113bee1 100644
--- a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/ServerMetricsTmpl.jamon
+++ b/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/ServerMetricsTmpl.jamon
@@ -84,7 +84,7 @@ java.lang.management.ManagementFactory;
         <td><% mWrap.getNumOnlineRegions() %></td>
         <td><% mWrap.getPercentFileLocal() %></td>
         <td><% mWrap.getPercentFileLocalSecondaryRegions() %></td>
-        <td><% 0 %></td>
+        <td><% mWrap.getNumWALSlowAppend() %></td>
     </tr>
 </table>
 </%def>

http://git-wip-us.apache.org/repos/asf/hbase/blob/51503efc/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 108ca6c..f3e8916 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
@@ -37,6 +37,7 @@ import org.apache.hadoop.hbase.io.hfile.CacheConfig;
 import org.apache.hadoop.hbase.io.hfile.CacheStats;
 import org.apache.hadoop.hbase.mob.MobCacheConfig;
 import org.apache.hadoop.hbase.mob.MobFileCache;
+import org.apache.hadoop.hbase.regionserver.wal.MetricsWALSource;
 import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
 import org.apache.hadoop.hbase.util.FSUtils;
 import org.apache.hadoop.hbase.wal.WALProvider;
@@ -54,6 +55,7 @@ class MetricsRegionServerWrapperImpl
   private static final Log LOG = LogFactory.getLog(MetricsRegionServerWrapperImpl.class);
 
   private final HRegionServer regionServer;
+  private final MetricsWALSource metricsWALSource;
 
   private BlockCache blockCache;
   private MobFileCache mobFileCache;
@@ -121,6 +123,7 @@ class MetricsRegionServerWrapperImpl
     this.runnable = new RegionServerMetricsWrapperRunnable();
     this.executor.scheduleWithFixedDelay(this.runnable, this.period, this.period,
       TimeUnit.MILLISECONDS);
+    this.metricsWALSource = CompatibilitySingletonFactory.getInstance(MetricsWALSource.class);
 
     try {
       this.dfsHedgedReadMetrics = FSUtils.getDFSHedgedReadMetrics(regionServer.getConfiguration());
@@ -374,6 +377,11 @@ class MetricsRegionServerWrapperImpl
   public long getWALFileSize() {
     return walFileSize;
   }
+
+  @Override
+  public long getNumWALSlowAppend() {
+    return metricsWALSource.getSlowAppendCount();
+  }
   
   @Override
   public long getNumStoreFiles() {

http://git-wip-us.apache.org/repos/asf/hbase/blob/51503efc/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 f450f01..0d93284 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
@@ -236,6 +236,11 @@ public class MetricsRegionServerWrapperStub implements MetricsRegionServerWrappe
   }
 
   @Override
+  public long getNumWALSlowAppend() {
+    return 0;
+  }
+
+  @Override
   public long getFlushedCellsCount() {
     return 100000000;
   }

http://git-wip-us.apache.org/repos/asf/hbase/blob/51503efc/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestMetricsWAL.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestMetricsWAL.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestMetricsWAL.java
index d9183d0..ba6915b 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestMetricsWAL.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestMetricsWAL.java
@@ -26,6 +26,7 @@ import org.junit.experimental.categories.Category;
 
 import java.util.concurrent.TimeUnit;
 
+import static org.junit.Assert.assertEquals;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
@@ -53,4 +54,16 @@ public class TestMetricsWAL {
     metricsWAL.postSync(nanos, 1);
     verify(source, times(1)).incrementSyncTime(145);
   }
+
+  @Test
+  public void testSlowAppend() throws Exception {
+    MetricsWALSource source = new MetricsWALSourceImpl();
+    MetricsWAL metricsWAL = new MetricsWAL(source);
+    // One not so slow append (< 1000)
+    metricsWAL.postAppend(1, 900);
+    // Two slow appends (> 1000)
+    metricsWAL.postAppend(1, 1010);
+    metricsWAL.postAppend(1, 2000);
+    assertEquals(2, source.getSlowAppendCount());
+  }
 }
\ No newline at end of file


Mime
View raw message