hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e...@apache.org
Subject [3/3] hbase git commit: HBASE-15435 Add WAL (in bytes) written metric (Alicia Ying Shu)
Date Fri, 11 Mar 2016 04:22:31 GMT
HBASE-15435 Add WAL (in bytes) written metric (Alicia Ying Shu)

Conflicts:
	hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/regionserver/wal/MetricsWALSource.java
	hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/regionserver/wal/MetricsWALSourceImpl.java
	hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestMetricsWAL.java


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

Branch: refs/heads/branch-1.3
Commit: ab47fc93397ccc1dd2b4e50b1dc7b77740d22bd0
Parents: b04b394
Author: Enis Soztutar <enis@apache.org>
Authored: Thu Mar 10 19:30:31 2016 -0800
Committer: Enis Soztutar <enis@apache.org>
Committed: Thu Mar 10 20:22:15 2016 -0800

----------------------------------------------------------------------
 .../hbase/regionserver/wal/MetricsWALSource.java       |  5 +++++
 .../hbase/regionserver/wal/MetricsWALSourceImpl.java   | 13 +++++++++++++
 .../hadoop/hbase/regionserver/wal/MetricsWAL.java      |  1 +
 .../hadoop/hbase/regionserver/wal/TestMetricsWAL.java  | 13 ++++++++++++-
 4 files changed, 31 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/ab47fc93/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..2be1d0d 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
@@ -62,6 +62,8 @@ public interface MetricsWALSource extends BaseSource {
   String LOW_REPLICA_ROLL_REQUESTED = "lowReplicaRollRequest";
   String LOW_REPLICA_ROLL_REQUESTED_DESC =
       "How many times a log roll was requested due to too few DN's in the write pipeline.";
+  String WRITTEN_BYTES = "writtenBytes";
+  String WRITTEN_BYTES_DESC = "Size (in bytes) of the data written to the WAL.";
 
   /**
    * Add the append size.
@@ -92,4 +94,7 @@ public interface MetricsWALSource extends BaseSource {
 
   void incrementLowReplicationLogRoll();
 
+  void incrementWrittenBytes(long val);
+
+  long getWrittenBytes();
 }

http://git-wip-us.apache.org/repos/asf/hbase/blob/ab47fc93/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 aec3278..1299637 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
@@ -40,6 +40,7 @@ public class MetricsWALSourceImpl extends BaseSourceImpl implements MetricsWALSo
   private final MutableFastCounter slowAppendCount;
   private final MutableFastCounter logRollRequested;
   private final MutableFastCounter lowReplicationLogRollRequested;
+  private final MutableFastCounter writtenBytes;
 
   public MetricsWALSourceImpl() {
     this(METRICS_NAME, METRICS_DESCRIPTION, METRICS_CONTEXT, METRICS_JMX_CONTEXT);
@@ -62,6 +63,7 @@ public class MetricsWALSourceImpl extends BaseSourceImpl implements MetricsWALSo
         this.getMetricsRegistry().newCounter(ROLL_REQUESTED, ROLL_REQUESTED_DESC, 0L);
     lowReplicationLogRollRequested = this.getMetricsRegistry()
         .newCounter(LOW_REPLICA_ROLL_REQUESTED, LOW_REPLICA_ROLL_REQUESTED_DESC, 0L);
+    writtenBytes = this.getMetricsRegistry().newCounter(WRITTEN_BYTES, WRITTEN_BYTES_DESC,
0l);
   }
 
   @Override
@@ -98,4 +100,15 @@ public class MetricsWALSourceImpl extends BaseSourceImpl implements MetricsWALSo
   public void incrementLowReplicationLogRoll() {
     lowReplicationLogRollRequested.incr();
   }
+
+  @Override
+  public void incrementWrittenBytes(long val) {
+    writtenBytes.incr(val);
+  }
+
+  @Override
+  public long getWrittenBytes() {
+    return writtenBytes.value();
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/hbase/blob/ab47fc93/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/MetricsWAL.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/MetricsWAL.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/MetricsWAL.java
index 24fd940..99792e5 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/MetricsWAL.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/MetricsWAL.java
@@ -55,6 +55,7 @@ public class MetricsWAL extends WALActionsListener.Base {
     source.incrementAppendCount();
     source.incrementAppendTime(time);
     source.incrementAppendSize(size);
+    source.incrementWrittenBytes(size);
 
     if (time > 1000) {
       source.incrementSlowAppendCount();

http://git-wip-us.apache.org/repos/asf/hbase/blob/ab47fc93/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 ffb20db..7be3e66 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
@@ -52,4 +52,15 @@ public class TestMetricsWAL {
     metricsWAL.postSync(nanos, 1);
     verify(source, times(1)).incrementSyncTime(145);
   }
-}
\ No newline at end of file
+
+  @Test
+  public void testWalWrittenInBytes() throws Exception {
+    MetricsWALSource source = mock(MetricsWALSourceImpl.class);
+    MetricsWAL metricsWAL = new MetricsWAL(source);
+    metricsWAL.postAppend(100, 900);
+    metricsWAL.postAppend(200, 2000);
+    verify(source, times(1)).incrementWrittenBytes(100);
+    verify(source, times(1)).incrementWrittenBytes(200);
+  }
+
+}


Mime
View raw message