HBASE-16752 addendum. Do not retry large request for client versions less than 1.3

Signed-off-by: Gary Helmling <garyh@apache.org>
This commit is contained in:
Ashu Pachauri 2016-10-19 16:50:52 -07:00 committed by Gary Helmling
parent a7a4e17f1d
commit 0117ed9d78
2 changed files with 13 additions and 2 deletions

View File

@ -26,13 +26,17 @@ import org.apache.hadoop.hbase.classification.InterfaceStability;
* Thrown when the size of the rpc request received by the server is too large.
*
* On receiving such an exception, the client does not retry the offending rpc.
* @since 1.3.0
*/
@InterfaceAudience.Public
@InterfaceStability.Evolving
public class RequestTooBigException extends DoNotRetryIOException {
private static final long serialVersionUID = -1593339239809586516L;
// Recognized only in HBase version 1.3 and higher.
public static final int MAJOR_VERSION = 1;
public static final int MINOR_VERSION = 3;
public RequestTooBigException() {
super();
}

View File

@ -1690,7 +1690,14 @@ public class RpcServer implements RpcServerInterface, ConfigurationObserver {
Call reqTooBig = new Call(header.getCallId(), this.service, null, null, null,
null, this, responder, 0, null, this.addr,0);
metrics.exception(REQUEST_TOO_BIG_EXCEPTION);
setupResponse(null, reqTooBig, REQUEST_TOO_BIG_EXCEPTION, msg);
// Make sure the client recognizes the underlying exception
// Otherwise, throw a DoNotRetryIOException.
if (VersionInfoUtil.hasMinimumVersion(connectionHeader.getVersionInfo(),
RequestTooBigException.MAJOR_VERSION, RequestTooBigException.MINOR_VERSION)) {
setupResponse(null, reqTooBig, REQUEST_TOO_BIG_EXCEPTION, msg);
} else {
setupResponse(null, reqTooBig, new DoNotRetryIOException(), msg);
}
// We are going to close the connection, make sure we process the response
// before that. In rare case when this fails, we still close the connection.
responseWriteLock.lock();