HBASE-16752 addendum. Do not retry large request for client versions less than 1.3
Signed-off-by: Gary Helmling <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/0117ed9d Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/0117ed9d Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/0117ed9d Branch: refs/heads/branch-1 Commit: 0117ed9d78820abecf066d742782de1dd49f309e Parents: a7a4e17 Author: Ashu Pachauri <[email protected]> Authored: Wed Oct 19 16:50:52 2016 -0700 Committer: Gary Helmling <[email protected]> Committed: Thu Oct 20 10:34:46 2016 -0700 ---------------------------------------------------------------------- .../hadoop/hbase/exceptions/RequestTooBigException.java | 6 +++++- .../main/java/org/apache/hadoop/hbase/ipc/RpcServer.java | 9 ++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/0117ed9d/hbase-client/src/main/java/org/apache/hadoop/hbase/exceptions/RequestTooBigException.java ---------------------------------------------------------------------- diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/exceptions/RequestTooBigException.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/exceptions/RequestTooBigException.java index 31baebb..0021f4a 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/exceptions/RequestTooBigException.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/exceptions/RequestTooBigException.java @@ -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(); } http://git-wip-us.apache.org/repos/asf/hbase/blob/0117ed9d/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 9c21bbe..c2698b1 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 @@ -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();
