HBASE-20810 Include the procedure id in the exception message in HBaseAdmin for better debugging

This commit is contained in:
zhangduo 2018-06-28 22:00:11 +08:00
parent fe75f90be2
commit 63477d6251
1 changed files with 6 additions and 8 deletions

View File

@ -3363,7 +3363,7 @@ public class HBaseAdmin implements Admin {
private V result = null; private V result = null;
private final HBaseAdmin admin; private final HBaseAdmin admin;
private final Long procId; protected final Long procId;
public ProcedureFuture(final HBaseAdmin admin, final Long procId) { public ProcedureFuture(final HBaseAdmin admin, final Long procId) {
this.admin = admin; this.admin = admin;
@ -3645,22 +3645,20 @@ public class HBaseAdmin implements Admin {
* @return a description of the operation * @return a description of the operation
*/ */
protected String getDescription() { protected String getDescription() {
return "Operation: " + getOperationType() + ", " return "Operation: " + getOperationType() + ", " + "Table Name: " +
+ "Table Name: " + tableName.getNameWithNamespaceInclAsString(); tableName.getNameWithNamespaceInclAsString() + ", procId: " + procId;
} }
protected abstract class TableWaitForStateCallable implements WaitForStateCallable { protected abstract class TableWaitForStateCallable implements WaitForStateCallable {
@Override @Override
public void throwInterruptedException() throws InterruptedIOException { public void throwInterruptedException() throws InterruptedIOException {
throw new InterruptedIOException("Interrupted while waiting for operation: " throw new InterruptedIOException("Interrupted while waiting for " + getDescription());
+ getOperationType() + " on table: " + tableName.getNameWithNamespaceInclAsString());
} }
@Override @Override
public void throwTimeoutException(long elapsedTime) throws TimeoutException { public void throwTimeoutException(long elapsedTime) throws TimeoutException {
throw new TimeoutException("The operation: " + getOperationType() + " on table: " + throw new TimeoutException(
tableName.getNameAsString() + " has not completed after " + elapsedTime + "ms"); getDescription() + " has not completed after " + elapsedTime + "ms");
} }
} }