hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jerry...@apache.org
Subject hbase git commit: HBASE-15437 Response size calculated in RPCServer for warning tooLarge responses does NOT count CellScanner payload
Date Wed, 07 Dec 2016 22:53:38 GMT
Repository: hbase
Updated Branches:
  refs/heads/master 6f25f838c -> 75567f828


HBASE-15437 Response size calculated in RPCServer for warning tooLarge responses does NOT
count CellScanner payload


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/75567f82
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/75567f82
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/75567f82

Branch: refs/heads/master
Commit: 75567f828c3c07204f99dd3d2fbbd1686cebcb26
Parents: 6f25f83
Author: Jerry He <jerryjch@apache.org>
Authored: Wed Dec 7 14:47:10 2016 -0800
Committer: Jerry He <jerryjch@apache.org>
Committed: Wed Dec 7 14:47:10 2016 -0800

----------------------------------------------------------------------
 .../org/apache/hadoop/hbase/ipc/RpcServer.java  |  7 ++++-
 .../hbase/regionserver/RSRpcServices.java       | 27 +++++++++-----------
 2 files changed, 18 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/75567f82/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java
index 8b6379b..96f506f 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java
@@ -2659,8 +2659,13 @@ public class RpcServer implements RpcServerInterface, ConfigurationObserver
{
             " processingTime: " + processingTime +
             " totalTime: " + totalTime);
       }
-      long requestSize = param.getSerializedSize();
+      // Use the raw request call size for now.
+      long requestSize = call.getSize();
       long responseSize = result.getSerializedSize();
+      if (call.isClientCellBlockSupported()) {
+        // Include the payload size in HBaseRpcController
+        responseSize += call.getResponseCellSize();
+      }
 
       metrics.dequeuedCall(qTime);
       metrics.processedCall(processingTime);

http://git-wip-us.apache.org/repos/asf/hbase/blob/75567f82/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 07e16c8..7ec4f68 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
@@ -460,22 +460,14 @@ public class RSRpcServices implements HBaseRPCErrorHandler,
     }
   }
 
-  /**
-   * @return True if current call supports cellblocks
-   */
-  private boolean isClientCellBlockSupport() {
-    RpcCallContext context = RpcServer.getCurrentCall();
-    return context != null && context.isClientCellBlockSupported();
-  }
-
   private boolean isClientCellBlockSupport(RpcCallContext context) {
     return context != null && context.isClientCellBlockSupported();
   }
 
   private void addResult(final MutateResponse.Builder builder, final Result result,
-      final HBaseRpcController rpcc) {
+      final HBaseRpcController rpcc, boolean clientCellBlockSupported) {
     if (result == null) return;
-    if (isClientCellBlockSupport()) {
+    if (clientCellBlockSupported) {
       builder.setResult(ProtobufUtil.toResultNoData(result));
       rpcc.setCellScanner(result.cellScanner());
     } else {
@@ -1167,7 +1159,7 @@ public class RSRpcServices implements HBaseRPCErrorHandler,
    * @return an object that represents the last referenced block from this response.
    */
   Object addSize(RpcCallContext context, Result r, Object lastBlock) {
-    if (context != null && !r.isEmpty()) {
+    if (context != null && r != null && !r.isEmpty()) {
       for (Cell c : r.rawCells()) {
         context.incrementResponseCellSize(CellUtil.estimatedHeapSizeOf(c));
 
@@ -2299,12 +2291,12 @@ public class RSRpcServices implements HBaseRPCErrorHandler,
         builder.setResult(pbr);
       } else if (r != null) {
         ClientProtos.Result pbr;
-        RpcCallContext call = RpcServer.getCurrentCall();
-        if (isClientCellBlockSupport(call) && controller instanceof HBaseRpcController
-            && VersionInfoUtil.hasMinimumVersion(call.getClientVersionInfo(), 1,
3)) {
+        if (isClientCellBlockSupport(context) && controller instanceof HBaseRpcController
+            && VersionInfoUtil.hasMinimumVersion(context.getClientVersionInfo(),
1, 3)) {
           pbr = ProtobufUtil.toResultNoData(r);
           ((HBaseRpcController) controller).setCellScanner(CellUtil.createCellScanner(r
               .rawCells()));
+          addSize(context, r, null);
         } else {
           pbr = ProtobufUtil.toResult(r);
         }
@@ -2533,6 +2525,7 @@ public class RSRpcServices implements HBaseRPCErrorHandler,
     HBaseRpcController controller = (HBaseRpcController)rpcc;
     CellScanner cellScanner = controller != null ? controller.cellScanner() : null;
     OperationQuota quota = null;
+    RpcCallContext context = RpcServer.getCurrentCall();
     // Clear scanner so we are not holding on to reference across call.
     if (controller != null) {
       controller.setCellScanner(null);
@@ -2628,7 +2621,11 @@ public class RSRpcServices implements HBaseRPCErrorHandler,
       if (processed != null) {
         builder.setProcessed(processed.booleanValue());
       }
-      addResult(builder, r, controller);
+      boolean clientCellBlockSupported = isClientCellBlockSupport(context);
+      addResult(builder, r, controller, clientCellBlockSupported);
+      if (clientCellBlockSupported) {
+        addSize(context, r, null);
+      }
       return builder.build();
     } catch (IOException ie) {
       regionServer.checkFileSystem();


Mime
View raw message