hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mbau...@apache.org
Subject svn commit: r1396574 - in /hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase: ipc/ProfilingData.java regionserver/wal/HLog.java
Date Wed, 10 Oct 2012 12:50:33 GMT
Author: mbautin
Date: Wed Oct 10 12:50:32 2012
New Revision: 1396574

URL: http://svn.apache.org/viewvc?rev=1396574&view=rev
Log:
[HBASE-6964] [0.89-fb] Instrument Log Roll time

Author: aaiyer

Summary:
account for Log roll time in the Profiling data

Builds on the Log roll diff. Not to be committed before that goes in.

Test Plan:
run unit tests.
  do a bunch of puts with profiling. see that the metric shows up correctly.

Reviewers: kranganathan

Reviewed By: kranganathan

CC: hbase-eng@

Differential Revision: https://phabricator.fb.com/D577514

Modified:
    hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/ipc/ProfilingData.java
    hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLog.java

Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/ipc/ProfilingData.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/ipc/ProfilingData.java?rev=1396574&r1=1396573&r2=1396574&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/ipc/ProfilingData.java (original)
+++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/ipc/ProfilingData.java Wed
Oct 10 12:50:32 2012
@@ -68,6 +68,11 @@ public class ProfilingData implements Wr
   public static final String HLOG_SYNC_TIME_MS = "hlog_sync_time.ms";
   
   /**
+   *  time spend rolling HLog
+   */
+  public static final String HLOG_ROLL_TIME_MS = "hlog_roll_time.ms";
+
+  /**
    *  name of the rpc method called
    */
   public static final String RPC_METHOD_NAME = "rpc_method_name";

Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLog.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLog.java?rev=1396574&r1=1396573&r2=1396574&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLog.java
(original)
+++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLog.java
Wed Oct 10 12:50:32 2012
@@ -255,6 +255,9 @@ public class HLog implements Syncable {
   private final List<LogEntryVisitor> logEntryVisitors =
       new CopyOnWriteArrayList<LogEntryVisitor>();
 
+  private volatile long lastLogRollStartTimeMillis = 0;
+  private volatile long lastLogRollDurationMillis = 0;
+
   /**
    * Pattern used to validate a HLog file name
    */
@@ -558,6 +561,8 @@ public class HLog implements Syncable {
         this.numEntries.set(0);
 
         t1 = EnvironmentEdgeManager.currentTimeMillis();
+        lastLogRollStartTimeMillis = t0;
+        lastLogRollDurationMillis = (t1 - t0);
       }
 
       Path oldFile = null;
@@ -1022,9 +1027,18 @@ public class HLog implements Syncable {
     // sync txn to file system
     start = System.currentTimeMillis();
     this.sync(info.isMetaRegion(), txid);
-    time = System.currentTimeMillis() - start;
+    long end= System.currentTimeMillis();
+    time = end - start;
     gsyncTime.inc(time);
     if (pData != null) {
+      if (this.lastLogRollStartTimeMillis > start
+          && end > this.lastLogRollStartTimeMillis) {
+        // We also had a log roll in between
+        pData.addLong(ProfilingData.HLOG_ROLL_TIME_MS, this.lastLogRollDurationMillis);
+        // Do not account for this as the sync time.
+        time = time - this.lastLogRollDurationMillis;
+      }
+      // update sync time
       pData.addLong(ProfilingData.HLOG_SYNC_TIME_MS, time);
     }
   }



Mime
View raw message