From e5758e86a80ad74610295699abb20709aac1c225 Mon Sep 17 00:00:00 2001 From: zhangduo Date: Fri, 16 Nov 2018 11:18:58 +0800 Subject: [PATCH] HBASE-21485 Add more debug logs for remote procedure execution --- .../java/org/apache/hadoop/hbase/master/HMaster.java | 2 ++ .../regionserver/RemoteProcedureResultReporter.java | 2 ++ .../regionserver/handler/RSProcedureHandler.java | 11 ++++++----- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java index c8ba7ae581e..810bf07ce2f 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java @@ -3809,6 +3809,7 @@ public class HMaster extends HRegionServer implements MasterServices { } public void remoteProcedureCompleted(long procId) { + LOG.debug("Remote procedure done, pid={}", procId); RemoteProcedure procedure = getRemoteProcedure(procId); if (procedure != null) { procedure.remoteOperationCompleted(procedureExecutor.getEnvironment()); @@ -3816,6 +3817,7 @@ public class HMaster extends HRegionServer implements MasterServices { } public void remoteProcedureFailed(long procId, RemoteProcedureException error) { + LOG.debug("Remote procedure failed, pid={}", procId, error); RemoteProcedure procedure = getRemoteProcedure(procId); if (procedure != null) { procedure.remoteOperationFailed(procedureExecutor.getEnvironment(), error); diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RemoteProcedureResultReporter.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RemoteProcedureResultReporter.java index ac3e95a1435..efb044a7846 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RemoteProcedureResultReporter.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RemoteProcedureResultReporter.java @@ -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()); diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/handler/RSProcedureHandler.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/handler/RSProcedureHandler.java index d2175d0f44d..ddff13f0dd9 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/handler/RSProcedureHandler.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/handler/RSProcedureHandler.java @@ -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); } }