HBASE-17445 Count size of serialized exceptions in checking max result size quota
This commit is contained in:
parent
2f7ce65b81
commit
56f963f4a6
|
@ -86,6 +86,9 @@ public interface RpcCallContext {
|
||||||
long getResponseBlockSize();
|
long getResponseBlockSize();
|
||||||
void incrementResponseBlockSize(long blockSize);
|
void incrementResponseBlockSize(long blockSize);
|
||||||
|
|
||||||
|
long getResponseExceptionSize();
|
||||||
|
void incrementResponseExceptionSize(long exceptionSize);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the deadline of this call. If we can not complete this call in time, we can throw a
|
* Return the deadline of this call. If we can not complete this call in time, we can throw a
|
||||||
* TimeoutIOException and RPCServer will drop it.
|
* TimeoutIOException and RPCServer will drop it.
|
||||||
|
|
|
@ -348,6 +348,8 @@ public class RpcServer implements RpcServerInterface, ConfigurationObserver {
|
||||||
|
|
||||||
private long responseCellSize = 0;
|
private long responseCellSize = 0;
|
||||||
private long responseBlockSize = 0;
|
private long responseBlockSize = 0;
|
||||||
|
// cumulative size of serialized exceptions
|
||||||
|
private long exceptionSize = 0;
|
||||||
private boolean retryImmediatelySupported;
|
private boolean retryImmediatelySupported;
|
||||||
|
|
||||||
@edu.umd.cs.findbugs.annotations.SuppressWarnings(value="NP_NULL_ON_SOME_PATH",
|
@edu.umd.cs.findbugs.annotations.SuppressWarnings(value="NP_NULL_ON_SOME_PATH",
|
||||||
|
@ -563,6 +565,15 @@ public class RpcServer implements RpcServerInterface, ConfigurationObserver {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getResponseExceptionSize() {
|
||||||
|
return exceptionSize;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void incrementResponseExceptionSize(long exSize) {
|
||||||
|
exceptionSize += exSize;
|
||||||
|
}
|
||||||
|
|
||||||
public long getSize() {
|
public long getSize() {
|
||||||
return this.size;
|
return this.size;
|
||||||
}
|
}
|
||||||
|
|
|
@ -156,6 +156,7 @@ import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ResultOrException
|
||||||
import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ScanRequest;
|
import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ScanRequest;
|
||||||
import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ScanResponse;
|
import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ScanResponse;
|
||||||
import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameInt64Pair;
|
import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameInt64Pair;
|
||||||
|
import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameBytesPair;
|
||||||
import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.RegionInfo;
|
import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.RegionInfo;
|
||||||
import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.RegionSpecifier;
|
import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.RegionSpecifier;
|
||||||
import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.RegionSpecifier.RegionSpecifierType;
|
import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.RegionSpecifier.RegionSpecifierType;
|
||||||
|
@ -657,7 +658,8 @@ public class RSRpcServices implements HBaseRPCErrorHandler,
|
||||||
if (context != null
|
if (context != null
|
||||||
&& context.isRetryImmediatelySupported()
|
&& context.isRetryImmediatelySupported()
|
||||||
&& (context.getResponseCellSize() > maxQuotaResultSize
|
&& (context.getResponseCellSize() > maxQuotaResultSize
|
||||||
|| context.getResponseBlockSize() > maxQuotaResultSize)) {
|
|| context.getResponseBlockSize() + context.getResponseExceptionSize()
|
||||||
|
> maxQuotaResultSize)) {
|
||||||
|
|
||||||
// We're storing the exception since the exception and reason string won't
|
// We're storing the exception since the exception and reason string won't
|
||||||
// change after the response size limit is reached.
|
// change after the response size limit is reached.
|
||||||
|
@ -680,7 +682,9 @@ public class RSRpcServices implements HBaseRPCErrorHandler,
|
||||||
//
|
//
|
||||||
// This will create a copy in the builder.
|
// This will create a copy in the builder.
|
||||||
hasResultOrException = true;
|
hasResultOrException = true;
|
||||||
resultOrExceptionBuilder.setException(ResponseConverter.buildException(sizeIOE));
|
NameBytesPair pair = ResponseConverter.buildException(sizeIOE);
|
||||||
|
resultOrExceptionBuilder.setException(pair);
|
||||||
|
context.incrementResponseExceptionSize(pair.getSerializedSize());
|
||||||
resultOrExceptionBuilder.setIndex(action.getIndex());
|
resultOrExceptionBuilder.setIndex(action.getIndex());
|
||||||
builder.addResultOrException(resultOrExceptionBuilder.build());
|
builder.addResultOrException(resultOrExceptionBuilder.build());
|
||||||
if (cellScanner != null) {
|
if (cellScanner != null) {
|
||||||
|
@ -712,7 +716,9 @@ public class RSRpcServices implements HBaseRPCErrorHandler,
|
||||||
.setValue(result.toByteString())));
|
.setValue(result.toByteString())));
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
rpcServer.getMetrics().exception(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()) {
|
} else if (action.hasMutation()) {
|
||||||
MutationType type = action.getMutation().getMutateType();
|
MutationType type = action.getMutation().getMutateType();
|
||||||
|
@ -766,7 +772,9 @@ public class RSRpcServices implements HBaseRPCErrorHandler,
|
||||||
} catch (IOException ie) {
|
} catch (IOException ie) {
|
||||||
rpcServer.getMetrics().exception(ie);
|
rpcServer.getMetrics().exception(ie);
|
||||||
hasResultOrException = true;
|
hasResultOrException = true;
|
||||||
resultOrExceptionBuilder.setException(ResponseConverter.buildException(ie));
|
NameBytesPair pair = ResponseConverter.buildException(ie);
|
||||||
|
resultOrExceptionBuilder.setException(pair);
|
||||||
|
context.incrementResponseExceptionSize(pair.getSerializedSize());
|
||||||
}
|
}
|
||||||
if (hasResultOrException) {
|
if (hasResultOrException) {
|
||||||
// Propagate index.
|
// Propagate index.
|
||||||
|
|
Loading…
Reference in New Issue