Repository: hbase Updated Branches: refs/heads/branch-1.3 77cf73b75 -> eb19a6748
HBASE-17387 Reduce the overhead of exception report in RegionActionResult for multi() Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/eb19a674 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/eb19a674 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/eb19a674 Branch: refs/heads/branch-1.3 Commit: eb19a67486e1d722ce2f9d3484c0a7b111438d43 Parents: 77cf73b Author: tedyu <[email protected]> Authored: Tue Jan 17 07:56:43 2017 -0800 Committer: tedyu <[email protected]> Committed: Tue Jan 17 07:56:43 2017 -0800 ---------------------------------------------------------------------- .../hbase/regionserver/RSRpcServices.java | 21 +++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/eb19a674/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java index 335eab2..acc0684 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java @@ -644,8 +644,11 @@ public class RSRpcServices implements HBaseRPCErrorHandler, RpcCallContext context = RpcServer.getCurrentCall(); IOException sizeIOE = null; Object lastBlock = null; + ClientProtos.ResultOrException.Builder resultOrExceptionBuilder = ResultOrException.newBuilder(); + boolean hasResultOrException = false; for (ClientProtos.Action action : actions.getActionList()) { - ClientProtos.ResultOrException.Builder resultOrExceptionBuilder = null; + hasResultOrException = false; + resultOrExceptionBuilder.clear(); try { Result r = null; @@ -674,8 +677,8 @@ public class RSRpcServices implements HBaseRPCErrorHandler, // use it for the response. // // This will create a copy in the builder. - resultOrExceptionBuilder = ResultOrException.newBuilder(). - setException(ResponseConverter.buildException(sizeIOE)); + hasResultOrException = true; + resultOrExceptionBuilder.setException(ResponseConverter.buildException(sizeIOE)); resultOrExceptionBuilder.setIndex(action.getIndex()); builder.addResultOrException(resultOrExceptionBuilder.build()); if (cellScanner != null) { @@ -695,7 +698,7 @@ public class RSRpcServices implements HBaseRPCErrorHandler, } } } else if (action.hasServiceCall()) { - resultOrExceptionBuilder = ResultOrException.newBuilder(); + hasResultOrException = true; try { Message result = execServiceOnRegion(region, action.getServiceCall()); ClientProtos.CoprocessorServiceResult.Builder serviceResultBuilder = @@ -751,8 +754,8 @@ public class RSRpcServices implements HBaseRPCErrorHandler, pbResult = ProtobufUtil.toResult(r); } lastBlock = addSize(context, r, lastBlock); - resultOrExceptionBuilder = - ClientProtos.ResultOrException.newBuilder().setResult(pbResult); + hasResultOrException = true; + resultOrExceptionBuilder.setResult(pbResult); } // Could get to here and there was no result and no exception. Presumes we added // a Put or Delete to the collecting Mutations List for adding later. In this @@ -760,10 +763,10 @@ public class RSRpcServices implements HBaseRPCErrorHandler, // down in the doBatchOp method call rather than up here. } catch (IOException ie) { rpcServer.getMetrics().exception(ie); - resultOrExceptionBuilder = ResultOrException.newBuilder(). - setException(ResponseConverter.buildException(ie)); + hasResultOrException = true; + resultOrExceptionBuilder.setException(ResponseConverter.buildException(ie)); } - if (resultOrExceptionBuilder != null) { + if (hasResultOrException) { // Propagate index. resultOrExceptionBuilder.setIndex(action.getIndex()); builder.addResultOrException(resultOrExceptionBuilder.build());
