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..f998297 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,10 @@ public class RpcServer implements RpcServerInterface, ConfigurationObserver { " processingTime: " + processingTime + " totalTime: " + totalTime); } - long requestSize = param.getSerializedSize(); - long responseSize = result.getSerializedSize(); + // Use the raw request call size for now. + long requestSize = call.getSize(); + // Support including the payload size in HBaseRpcController + long responseSize = result.getSerializedSize() + call.getResponseCellSize(); metrics.dequeuedCall(qTime); metrics.processedCall(processingTime); 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..ae21cda 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 @@ -1167,7 +1167,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)); @@ -2272,6 +2272,7 @@ public class RSRpcServices implements HBaseRPCErrorHandler, Boolean existence = null; Result r = null; RpcCallContext context = RpcServer.getCurrentCall(); + Object lastBlock = null; quota = getQuotaManager().checkQuota(region, OperationQuota.OperationType.GET); Get clientGet = ProtobufUtil.toGet(get); @@ -2299,12 +2300,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())); + lastBlock = addSize(context, r, lastBlock); } else { pbr = ProtobufUtil.toResult(r); } @@ -2533,6 +2534,8 @@ public class RSRpcServices implements HBaseRPCErrorHandler, HBaseRpcController controller = (HBaseRpcController)rpcc; CellScanner cellScanner = controller != null ? controller.cellScanner() : null; OperationQuota quota = null; + RpcCallContext context = RpcServer.getCurrentCall(); + Object lastBlock = null; // Clear scanner so we are not holding on to reference across call. if (controller != null) { controller.setCellScanner(null); @@ -2629,6 +2632,7 @@ public class RSRpcServices implements HBaseRPCErrorHandler, builder.setProcessed(processed.booleanValue()); } addResult(builder, r, controller); + lastBlock = addSize(context, r, lastBlock); return builder.build(); } catch (IOException ie) { regionServer.checkFileSystem();