hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apurt...@apache.org
Subject hbase git commit: Amend HBASE-12424 Finer grained logging and metrics for split transactions; Hadoop 1 build fixes
Date Sat, 08 Nov 2014 06:28:54 GMT
Repository: hbase
Updated Branches:
  refs/heads/0.98 f279c7513 -> 25bc762ba


Amend HBASE-12424 Finer grained logging and metrics for split transactions; Hadoop 1 build
fixes


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

Branch: refs/heads/0.98
Commit: 25bc762ba6f058e7e76ae9134f3e4f637db044b1
Parents: f279c75
Author: Andrew Purtell <apurtell@apache.org>
Authored: Fri Nov 7 22:23:16 2014 -0800
Committer: Andrew Purtell <apurtell@apache.org>
Committed: Fri Nov 7 22:25:05 2014 -0800

----------------------------------------------------------------------
 .../org/apache/hadoop/hbase/util/Strings.java   | 21 ++++++++++++++++++++
 .../MetricsRegionServerSourceImpl.java          | 16 +++++++++++++++
 .../hadoop/hbase/regionserver/SplitRequest.java |  3 ++-
 3 files changed, 39 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/25bc762b/hbase-common/src/main/java/org/apache/hadoop/hbase/util/Strings.java
----------------------------------------------------------------------
diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/util/Strings.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/util/Strings.java
index b4b4a13..1c0b3f4 100644
--- a/hbase-common/src/main/java/org/apache/hadoop/hbase/util/Strings.java
+++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/util/Strings.java
@@ -18,6 +18,8 @@
  */
 package org.apache.hadoop.hbase.util;
 
+import java.util.Iterator;
+
 import org.apache.hadoop.hbase.classification.InterfaceAudience;
 
 /**
@@ -111,4 +113,23 @@ public class Strings {
     }
     return sb.toString();
   }
+
+  /**
+   * Concatenates strings, using a separator.
+   *
+   * @param separator Separator to join with.
+   * @param strings Strings to join.
+   */
+  public static String join(CharSequence separator, Iterable<?> strings) {
+    Iterator<?> i = strings.iterator();
+    if (!i.hasNext()) {
+      return "";
+    }
+    StringBuilder sb = new StringBuilder(i.next().toString());
+    while (i.hasNext()) {
+      sb.append(separator);
+      sb.append(i.next().toString());
+    }
+    return sb.toString();
+  }
 }

http://git-wip-us.apache.org/repos/asf/hbase/blob/25bc762b/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 be67541..ffb3055 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
@@ -45,6 +45,9 @@ public class MetricsRegionServerSourceImpl
   private final MetricMutableCounterLong slowIncrement;
   private final MetricMutableCounterLong slowAppend;
 
+  private final MetricHistogram splitTimeHisto;
+  private final MetricHistogram flushTimeHisto;
+
   public MetricsRegionServerSourceImpl(MetricsRegionServerWrapper rsWrap) {
     this(METRICS_NAME, METRICS_DESCRIPTION, METRICS_CONTEXT, METRICS_JMX_CONTEXT, rsWrap);
   }
@@ -73,6 +76,9 @@ public class MetricsRegionServerSourceImpl
     slowAppend = getMetricsRegistry().newCounter(SLOW_APPEND_KEY, SLOW_APPEND_DESC, 0l);
 
     replayHisto = getMetricsRegistry().newHistogram(REPLAY_KEY);
+
+    splitTimeHisto = getMetricsRegistry().newHistogram(SPLIT_KEY);
+    flushTimeHisto = getMetricsRegistry().newHistogram(FLUSH_KEY);
   }
 
   @Override
@@ -130,6 +136,16 @@ public class MetricsRegionServerSourceImpl
     slowAppend.incr();
   }
 
+  @Override
+  public void updateSplitTime(long t) {
+    splitTimeHisto.add(t);
+  }
+
+  @Override
+  public void updateFlushTime(long t) {
+    flushTimeHisto.add(t);
+  }
+
   /**
    * Yes this is a get function that doesn't return anything.  Thanks Hadoop for breaking
all
    * expectations of java programmers.  Instead of returning anything Hadoop metrics expects

http://git-wip-us.apache.org/repos/asf/hbase/blob/25bc762b/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 2c0a0a0..b395f08 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
@@ -27,6 +27,7 @@ import org.apache.hadoop.hbase.RemoteExceptionHandler;
 import org.apache.hadoop.hbase.master.TableLockManager.TableLock;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
+import org.apache.hadoop.hbase.util.Strings;
 import org.apache.hadoop.util.StringUtils;
 
 import com.google.common.base.Preconditions;
@@ -136,7 +137,7 @@ class SplitRequest implements Runnable {
             + StringUtils.formatTimeDiff(EnvironmentEdgeManager.currentTimeMillis(), startTime));
       }
       // Always log the split transaction journal
-      LOG.info("Split transaction journal:\n\t" + StringUtils.join("\n\t", st.getJournal()));
+      LOG.info("Split transaction journal:\n\t" + Strings.join("\n\t", st.getJournal()));
     }
   }
 


Mime
View raw message