hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From syuanji...@apache.org
Subject hbase git commit: HBASE-15413 Procedure-V2: print out ProcedureInfo during trace (Stephen Yuan Jiang)
Date Tue, 08 Mar 2016 04:43:47 GMT
Repository: hbase
Updated Branches:
  refs/heads/master e477c143b -> 1c6beb3dc


HBASE-15413 Procedure-V2: print out ProcedureInfo during trace (Stephen Yuan Jiang)


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

Branch: refs/heads/master
Commit: 1c6beb3dc1a651e8d40ac0e9c7191727cf8cf413
Parents: e477c14
Author: Stephen Yuan Jiang <syuanjiangdev@gmail.com>
Authored: Mon Mar 7 20:28:45 2016 -0800
Committer: Stephen Yuan Jiang <syuanjiangdev@gmail.com>
Committed: Mon Mar 7 20:28:45 2016 -0800

----------------------------------------------------------------------
 .../org/apache/hadoop/hbase/ProcedureInfo.java  | 40 ++++++++++++++++++++
 1 file changed, 40 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/1c6beb3d/hbase-common/src/main/java/org/apache/hadoop/hbase/ProcedureInfo.java
----------------------------------------------------------------------
diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/ProcedureInfo.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/ProcedureInfo.java
index 6a1f479..4880a6d 100644
--- a/hbase-common/src/main/java/org/apache/hadoop/hbase/ProcedureInfo.java
+++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/ProcedureInfo.java
@@ -27,8 +27,10 @@ import org.apache.hadoop.hbase.protobuf.generated.ProcedureProtos;
 import org.apache.hadoop.hbase.protobuf.generated.ProcedureProtos.ProcedureState;
 import org.apache.hadoop.hbase.security.User;
 import org.apache.hadoop.hbase.util.ByteStringer;
+import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
 import org.apache.hadoop.hbase.util.ForeignExceptionUtil;
 import org.apache.hadoop.hbase.util.NonceKey;
+import org.apache.hadoop.util.StringUtils;
 
 /**
  * Procedure information
@@ -82,6 +84,40 @@ public class ProcedureInfo implements Cloneable {
       exception, lastUpdate, startTime, result);
   }
 
+  @Override
+  public String toString() {
+    StringBuilder sb = new StringBuilder();
+    sb.append("Procedure=");
+    sb.append(procName);
+    sb.append(" (id=");
+    sb.append(procId);
+    if (hasParentId()) {
+      sb.append(", parent=");
+      sb.append(parentId);
+    }
+    if (hasOwner()) {
+      sb.append(", owner=");
+      sb.append(procOwner);
+    }
+    sb.append(", state=");
+    sb.append(procState);
+
+    long now = EnvironmentEdgeManager.currentTime();
+    sb.append(", startTime=");
+    sb.append(StringUtils.formatTime(now - startTime));
+    sb.append(" ago, lastUpdate=");
+    sb.append(StringUtils.formatTime(now - startTime));
+    sb.append(" ago");
+
+    if (isFailed()) {
+      sb.append(", exception=\"");
+      sb.append(getExceptionMessage());
+      sb.append("\"");
+    }
+    sb.append(")");
+    return sb.toString();
+  }
+
   public long getProcId() {
     return procId;
   }
@@ -90,6 +126,10 @@ public class ProcedureInfo implements Cloneable {
     return procName;
   }
 
+  private boolean hasOwner() {
+    return procOwner != null;
+  }
+
   public String getProcOwner() {
     return procOwner;
   }


Mime
View raw message