HBASE-21485 Add more debug logs for remote procedure execution

This commit is contained in:
zhangduo 2018-11-16 11:18:58 +08:00
parent a819875939
commit 43a10df70f
4 changed files with 13 additions and 5 deletions

View File

@ -3888,6 +3888,7 @@ public class HMaster extends HRegionServer implements MasterServices {
}
public void remoteProcedureCompleted(long procId) {
LOG.debug("Remote procedure done, pid={}", procId);
RemoteProcedure<MasterProcedureEnv, ?> procedure = getRemoteProcedure(procId);
if (procedure != null) {
procedure.remoteOperationCompleted(procedureExecutor.getEnvironment());
@ -3895,6 +3896,7 @@ public class HMaster extends HRegionServer implements MasterServices {
}
public void remoteProcedureFailed(long procId, RemoteProcedureException error) {
LOG.debug("Remote procedure failed, pid={}", procId, error);
RemoteProcedure<MasterProcedureEnv, ?> procedure = getRemoteProcedure(procId);
if (procedure != null) {
procedure.remoteOperationFailed(procedureExecutor.getEnvironment(), error);

View File

@ -3734,10 +3734,13 @@ public class RSRpcServices implements HBaseRPCErrorHandler,
callable = Class.forName(request.getProcClass()).asSubclass(RSProcedureCallable.class)
.getDeclaredConstructor().newInstance();
} catch (Exception e) {
LOG.warn("Failed to instantiating remote procedure {}, pid={}", request.getProcClass(),
request.getProcId(), e);
regionServer.remoteProcedureComplete(request.getProcId(), e);
return;
}
callable.init(request.getProcData().toByteArray(), regionServer);
LOG.debug("Executing remote procedure {}, pid={}", callable.getClass(), request.getProcId());
regionServer.executeProcedure(request.getProcId(), callable);
}

View File

@ -57,9 +57,11 @@ class RemoteProcedureResultReporter extends Thread {
public void complete(long procId, Throwable error) {
RemoteProcedureResult.Builder builder = RemoteProcedureResult.newBuilder().setProcId(procId);
if (error != null) {
LOG.debug("Failed to complete execution of proc pid={}", procId, error);
builder.setStatus(RemoteProcedureResult.Status.ERROR).setError(
ForeignExceptionUtil.toProtoForeignException(server.getServerName().toString(), error));
} else {
LOG.debug("Successfully complete execution of proc pid={}", procId);
builder.setStatus(RemoteProcedureResult.Status.SUCCESS);
}
results.add(builder.build());

View File

@ -42,13 +42,14 @@ public class RSProcedureHandler extends EventHandler {
@Override
public void process() {
Exception error = null;
Throwable error = null;
try {
callable.call();
} catch (Exception e) {
LOG.error("Catch exception when call RSProcedureCallable: ", e);
error = e;
} catch (Throwable t) {
LOG.error("Error when call RSProcedureCallable: ", t);
error = t;
} finally {
((HRegionServer) server).remoteProcedureComplete(procId, error);
}
((HRegionServer) server).remoteProcedureComplete(procId, error);
}
}