HBASE-17445 Count size of serialized exceptions in checking max result size quota
This commit is contained in:
parent
953416eb34
commit
471cf13b1a
|
@ -98,4 +98,7 @@ public interface RpcCallContext {
|
|||
long getResponseBlockSize();
|
||||
|
||||
void incrementResponseBlockSize(long blockSize);
|
||||
|
||||
long getResponseExceptionSize();
|
||||
void incrementResponseExceptionSize(long exceptionSize);
|
||||
}
|
||||
|
|
|
@ -283,6 +283,8 @@ public abstract class RpcServer implements RpcServerInterface,
|
|||
|
||||
private long responseCellSize = 0;
|
||||
private long responseBlockSize = 0;
|
||||
// cumulative size of serialized exceptions
|
||||
private long exceptionSize = 0;
|
||||
private boolean retryImmediatelySupported;
|
||||
|
||||
@edu.umd.cs.findbugs.annotations.SuppressWarnings(value="NP_NULL_ON_SOME_PATH",
|
||||
|
@ -605,6 +607,15 @@ public abstract class RpcServer implements RpcServerInterface,
|
|||
responseBlockSize += blockSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getResponseExceptionSize() {
|
||||
return exceptionSize;
|
||||
}
|
||||
@Override
|
||||
public void incrementResponseExceptionSize(long exSize) {
|
||||
exceptionSize += exSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getSize() {
|
||||
return this.size;
|
||||
|
|
|
@ -168,6 +168,7 @@ import org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.ScanReques
|
|||
import org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.ScanResponse;
|
||||
import org.apache.hadoop.hbase.shaded.protobuf.generated.ClusterStatusProtos;
|
||||
import org.apache.hadoop.hbase.shaded.protobuf.generated.ClusterStatusProtos.RegionLoad;
|
||||
import org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.NameBytesPair;
|
||||
import org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.NameInt64Pair;
|
||||
import org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.RegionInfo;
|
||||
import org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.RegionSpecifier;
|
||||
|
@ -730,7 +731,8 @@ public class RSRpcServices implements HBaseRPCErrorHandler,
|
|||
if (context != null
|
||||
&& context.isRetryImmediatelySupported()
|
||||
&& (context.getResponseCellSize() > maxQuotaResultSize
|
||||
|| context.getResponseBlockSize() > maxQuotaResultSize)) {
|
||||
|| context.getResponseBlockSize() + context.getResponseExceptionSize()
|
||||
> maxQuotaResultSize)) {
|
||||
|
||||
// We're storing the exception since the exception and reason string won't
|
||||
// change after the response size limit is reached.
|
||||
|
@ -753,7 +755,9 @@ public class RSRpcServices implements HBaseRPCErrorHandler,
|
|||
//
|
||||
// This will create a copy in the builder.
|
||||
hasResultOrException = true;
|
||||
resultOrExceptionBuilder.setException(ResponseConverter.buildException(sizeIOE));
|
||||
NameBytesPair pair = ResponseConverter.buildException(sizeIOE);
|
||||
resultOrExceptionBuilder.setException(pair);
|
||||
context.incrementResponseExceptionSize(pair.getSerializedSize());
|
||||
resultOrExceptionBuilder.setIndex(action.getIndex());
|
||||
builder.addResultOrException(resultOrExceptionBuilder.build());
|
||||
if (cellScanner != null) {
|
||||
|
@ -791,7 +795,9 @@ public class RSRpcServices implements HBaseRPCErrorHandler,
|
|||
.setValue(UnsafeByteOperations.unsafeWrap(result.toByteArray()))));
|
||||
} catch (IOException ioe) {
|
||||
rpcServer.getMetrics().exception(ioe);
|
||||
resultOrExceptionBuilder.setException(ResponseConverter.buildException(ioe));
|
||||
NameBytesPair pair = ResponseConverter.buildException(ioe);
|
||||
resultOrExceptionBuilder.setException(pair);
|
||||
context.incrementResponseExceptionSize(pair.getSerializedSize());
|
||||
}
|
||||
} else if (action.hasMutation()) {
|
||||
MutationType type = action.getMutation().getMutateType();
|
||||
|
@ -845,7 +851,9 @@ public class RSRpcServices implements HBaseRPCErrorHandler,
|
|||
} catch (IOException ie) {
|
||||
rpcServer.getMetrics().exception(ie);
|
||||
hasResultOrException = true;
|
||||
resultOrExceptionBuilder.setException(ResponseConverter.buildException(ie));
|
||||
NameBytesPair pair = ResponseConverter.buildException(ie);
|
||||
resultOrExceptionBuilder.setException(pair);
|
||||
context.incrementResponseExceptionSize(pair.getSerializedSize());
|
||||
}
|
||||
if (hasResultOrException) {
|
||||
// Propagate index.
|
||||
|
|
Loading…
Reference in New Issue