From 466b8a9c6a7c5bc776a0aa307cf3b7224cc84d7f Mon Sep 17 00:00:00 2001 From: Nick Dimiduk Date: Thu, 20 Feb 2014 11:37:18 -0800 Subject: [PATCH] HBASE-10432 Rpc retries non-recoverable error --- .../java/org/apache/hadoop/hbase/client/RpcRetryingCaller.java | 3 +++ .../src/main/java/org/apache/hadoop/hbase/ipc/RpcClient.java | 8 ++++++-- .../src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java | 5 +++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RpcRetryingCaller.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RpcRetryingCaller.java index 6c51a70..f6f2bc9 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RpcRetryingCaller.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RpcRetryingCaller.java @@ -213,6 +213,9 @@ public class RpcRetryingCaller { if (t instanceof RemoteException) { t = ((RemoteException)t).unwrapRemoteException(); } + if (t instanceof Error) { + throw new DoNotRetryIOException(t); + } if (t instanceof ServiceException) { ServiceException se = (ServiceException)t; Throwable cause = se.getCause(); diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/RpcClient.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/RpcClient.java index b663aab..284c399 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/RpcClient.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/RpcClient.java @@ -33,6 +33,7 @@ import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.classification.InterfaceStability; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.CellScanner; +import org.apache.hadoop.hbase.DoNotRetryIOException; import org.apache.hadoop.hbase.HBaseIOException; import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.ServerName; @@ -779,8 +780,11 @@ public class RpcClient { } } catch (Throwable t) { failedServers.addToFailedServers(remoteId.address); - IOException e; - if (t instanceof IOException) { + IOException e = null; + if (t instanceof Error) { + // something serious happened. Do not retry + e = new DoNotRetryIOException(t); + } else if (t instanceof IOException) { e = (IOException)t; } else { e = new IOException("Could not set up IO Streams", t); 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 08f97fa..654da8e 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 @@ -1719,6 +1719,10 @@ public class RpcServer implements RpcServerInterface { String msg = "Unable to read call parameter from client " + getHostAddress(); LOG.warn(msg, t); + // language-level error happened, do not retry + if (t instanceof Error) { + t = new DoNotRetryIOException(t); + } // If the method is not present on the server, do not retry. if (t instanceof UnsupportedOperationException) { t = new DoNotRetryIOException(t); @@ -2049,6 +2053,7 @@ public class RpcServer implements RpcServerInterface { // putting it on the wire. Its needed to adhere to the pb Service Interface but we don't // need to pass it over the wire. if (e instanceof ServiceException) e = e.getCause(); + if (e instanceof Error) throw new DoNotRetryIOException(e); if (e instanceof IOException) throw (IOException)e; LOG.error("Unexpected throwable object ", e); throw new IOException(e.getMessage(), e); -- 1.8.5.1