You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by sy...@apache.org on 2017/01/04 07:39:43 UTC
[41/50] [abbrv] hbase git commit: HBASE-17387 Reduce the overhead of
exception report in RegionActionResult for multi()
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/1c477b2d
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/1c477b2d
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/1c477b2d
Branch: refs/heads/hbase-12439
Commit: 1c477b2df9f3cb10063d66d8f14ba9eb83bf9f4c
Parents: 7572e96
Author: tedyu <yu...@gmail.com>
Authored: Thu Dec 29 17:54:02 2016 -0800
Committer: tedyu <yu...@gmail.com>
Committed: Thu Dec 29 17:54:02 2016 -0800
----------------------------------------------------------------------
.../hbase/regionserver/RSRpcServices.java | 21 +++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/1c477b2d/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 27fef8d..f550267 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
@@ -719,8 +719,11 @@ public class RSRpcServices implements HBaseRPCErrorHandler,
long maxQuotaResultSize = Math.min(maxScannerResultSize, quota.getReadAvailable());
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;
@@ -749,8 +752,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) {
@@ -774,7 +777,7 @@ public class RSRpcServices implements HBaseRPCErrorHandler,
}
}
} else if (action.hasServiceCall()) {
- resultOrExceptionBuilder = ResultOrException.newBuilder();
+ hasResultOrException = true;
try {
com.google.protobuf.Message result =
execServiceOnRegion(region, action.getServiceCall());
@@ -832,8 +835,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
@@ -841,10 +844,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());