YARN-2841. RMProxy should retry EOFException. Contributed by Jian He

(cherry picked from commit 5c9a51f140)
This commit is contained in:
Xuan 2014-11-10 18:25:01 -08:00
parent 2b125b3a39
commit b3badf935a
4 changed files with 13 additions and 0 deletions

View File

@ -902,6 +902,8 @@ Release 2.6.0 - 2014-11-15
consistent with the (somewhat incorrect) behaviour in the non-recovery case. consistent with the (somewhat incorrect) behaviour in the non-recovery case.
(Jian He via vinodkv) (Jian He via vinodkv)
YARN-2841. RMProxy should retry EOFException. (Jian He via xgong)
Release 2.5.2 - 2014-11-10 Release 2.5.2 - 2014-11-10
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -18,6 +18,7 @@
package org.apache.hadoop.yarn.client; package org.apache.hadoop.yarn.client;
import java.io.EOFException;
import java.io.IOException; import java.io.IOException;
import java.net.ConnectException; import java.net.ConnectException;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
@ -240,6 +241,7 @@ public class RMProxy<T> {
Map<Class<? extends Exception>, RetryPolicy> exceptionToPolicyMap = Map<Class<? extends Exception>, RetryPolicy> exceptionToPolicyMap =
new HashMap<Class<? extends Exception>, RetryPolicy>(); new HashMap<Class<? extends Exception>, RetryPolicy>();
exceptionToPolicyMap.put(EOFException.class, retryPolicy);
exceptionToPolicyMap.put(ConnectException.class, retryPolicy); exceptionToPolicyMap.put(ConnectException.class, retryPolicy);
exceptionToPolicyMap.put(NoRouteToHostException.class, retryPolicy); exceptionToPolicyMap.put(NoRouteToHostException.class, retryPolicy);
exceptionToPolicyMap.put(UnknownHostException.class, retryPolicy); exceptionToPolicyMap.put(UnknownHostException.class, retryPolicy);

View File

@ -18,6 +18,7 @@
package org.apache.hadoop.yarn.client; package org.apache.hadoop.yarn.client;
import java.io.EOFException;
import java.net.ConnectException; import java.net.ConnectException;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.net.NoRouteToHostException; import java.net.NoRouteToHostException;
@ -67,6 +68,7 @@ public class ServerProxy {
Map<Class<? extends Exception>, RetryPolicy> exceptionToPolicyMap = Map<Class<? extends Exception>, RetryPolicy> exceptionToPolicyMap =
new HashMap<Class<? extends Exception>, RetryPolicy>(); new HashMap<Class<? extends Exception>, RetryPolicy>();
exceptionToPolicyMap.put(EOFException.class, retryPolicy);
exceptionToPolicyMap.put(ConnectException.class, retryPolicy); exceptionToPolicyMap.put(ConnectException.class, retryPolicy);
exceptionToPolicyMap.put(NoRouteToHostException.class, retryPolicy); exceptionToPolicyMap.put(NoRouteToHostException.class, retryPolicy);
exceptionToPolicyMap.put(UnknownHostException.class, retryPolicy); exceptionToPolicyMap.put(UnknownHostException.class, retryPolicy);

View File

@ -21,6 +21,7 @@ package org.apache.hadoop.yarn.server.nodemanager;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
import java.io.EOFException;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.net.InetAddress; import java.net.InetAddress;
@ -737,8 +738,14 @@ public class TestNodeStatusUpdater {
public NodeHeartbeatResponse nodeHeartbeat(NodeHeartbeatRequest request) public NodeHeartbeatResponse nodeHeartbeat(NodeHeartbeatRequest request)
throws YarnException, IOException { throws YarnException, IOException {
heartBeatID++; heartBeatID++;
if(heartBeatID == 1) {
// EOFException should be retried as well.
throw new EOFException("NodeHeartbeat exception");
}
else {
throw new java.net.ConnectException( throw new java.net.ConnectException(
"NodeHeartbeat exception"); "NodeHeartbeat exception");
}
} }
} }