hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apurt...@apache.org
Subject hbase git commit: HBASE-15435 Add WAL (in bytes) written metric (Alicia Ying Shu)
Date Fri, 18 Mar 2016 00:40:54 GMT
Repository: hbase
Updated Branches:
  refs/heads/0.98 46253a438 -> a68458a4d


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
	hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestMetricsWAL.java

Amending-Author: Andrew Purtell <apurtell@apache.org>


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

Branch: refs/heads/0.98
Commit: a68458a4dba1f411e015c14f97ccb17f6540dd25
Parents: 46253a4
Author: Enis Soztutar <enis@apache.org>
Authored: Thu Mar 10 19:30:31 2016 -0800
Committer: Andrew Purtell <apurtell@apache.org>
Committed: Thu Mar 17 17:38:26 2016 -0700

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


http://git-wip-us.apache.org/repos/asf/hbase/blob/a68458a4/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 b642a49..dee013a 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,5 @@ public interface MetricsWALSource extends BaseSource {
 
   void incrementLowReplicationLogRoll();
 
+  void incrementWrittenBytes(long val);
 }

http://git-wip-us.apache.org/repos/asf/hbase/blob/a68458a4/hbase-hadoop1-compat/src/main/java/org/apache/hadoop/hbase/regionserver/wal/MetricsWALSourceImpl.java
----------------------------------------------------------------------
diff --git a/hbase-hadoop1-compat/src/main/java/org/apache/hadoop/hbase/regionserver/wal/MetricsWALSourceImpl.java
b/hbase-hadoop1-compat/src/main/java/org/apache/hadoop/hbase/regionserver/wal/MetricsWALSourceImpl.java
index ea5ec51..86aa315 100644
--- a/hbase-hadoop1-compat/src/main/java/org/apache/hadoop/hbase/regionserver/wal/MetricsWALSourceImpl.java
+++ b/hbase-hadoop1-compat/src/main/java/org/apache/hadoop/hbase/regionserver/wal/MetricsWALSourceImpl.java
@@ -36,6 +36,7 @@ public class MetricsWALSourceImpl extends BaseSourceImpl implements MetricsWALSo
   private final MetricHistogram syncTimeHisto;
   private final MetricMutableCounterLong logRollRequested;
   private final MetricMutableCounterLong lowReplicationLogRollRequested;
+  private final MetricMutableCounterLong writtenBytes;
 
   public MetricsWALSourceImpl() {
     this(METRICS_NAME, METRICS_DESCRIPTION, METRICS_CONTEXT, METRICS_JMX_CONTEXT);
@@ -58,6 +59,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
@@ -94,4 +96,9 @@ public class MetricsWALSourceImpl extends BaseSourceImpl implements MetricsWALSo
   public void incrementLowReplicationLogRoll() {
     lowReplicationLogRollRequested.incr();
   }
+
+  @Override
+  public void incrementWrittenBytes(long val) {
+    writtenBytes.incr(val);
+  }
 }

http://git-wip-us.apache.org/repos/asf/hbase/blob/a68458a4/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 50cbda1..8ebd6bd 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
@@ -39,6 +39,7 @@ public class MetricsWALSourceImpl extends BaseSourceImpl implements MetricsWALSo
   private final MutableCounterLong slowAppendCount;
   private final MutableCounterLong logRollRequested;
   private final MutableCounterLong lowReplicationLogRollRequested;
+  private final MutableCounterLong writtenBytes;
 
   public MetricsWALSourceImpl() {
     this(METRICS_NAME, METRICS_DESCRIPTION, METRICS_CONTEXT, METRICS_JMX_CONTEXT);
@@ -61,6 +62,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
@@ -97,4 +99,9 @@ public class MetricsWALSourceImpl extends BaseSourceImpl implements MetricsWALSo
   public void incrementLowReplicationLogRoll() {
     lowReplicationLogRollRequested.incr();
   }
+
+  @Override
+  public void incrementWrittenBytes(long val) {
+    writtenBytes.incr(val);
+  }
 }

http://git-wip-us.apache.org/repos/asf/hbase/blob/a68458a4/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 ec1e89f..c86e2df 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
@@ -61,6 +61,7 @@ public class MetricsWAL implements WALActionsListener {
     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/a68458a4/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 719b80e..7a898e0 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
@@ -41,4 +41,15 @@ public class TestMetricsWAL {
     // One was because of low replication on the hlog.
     verify(source, times(1)).incrementLowReplicationLogRoll();
   }
-}
\ No newline at end of file
+
+  @Test
+  public void testWalWrittenInBytes() throws Exception {
+    MetricsWALSource source = mock(MetricsWALSourceImpl.class);
+    MetricsWAL metricsWAL = new MetricsWAL(source);
+    metricsWAL.finishAppend(900, 100);
+    metricsWAL.finishAppend(1000, 200);
+    verify(source, times(1)).incrementWrittenBytes(100);
+    verify(source, times(1)).incrementWrittenBytes(200);
+  }
+
+}


Mime
View raw message