HBASE-15413 Procedure-V2: print out ProcedureInfo during trace (Stephen Yuan Jiang)
This commit is contained in:
parent
e477c143bc
commit
1c6beb3dc1
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue