|
@@ -48,6 +48,7 @@ import org.apache.commons.logging.*;
|
|
import org.apache.hadoop.classification.InterfaceAudience;
|
|
import org.apache.hadoop.classification.InterfaceAudience;
|
|
import org.apache.hadoop.classification.InterfaceStability;
|
|
import org.apache.hadoop.classification.InterfaceStability;
|
|
import org.apache.hadoop.conf.Configuration;
|
|
import org.apache.hadoop.conf.Configuration;
|
|
|
|
+import org.apache.hadoop.fs.CommonConfigurationKeysPublic;
|
|
import org.apache.hadoop.ipc.RpcPayloadHeader.*;
|
|
import org.apache.hadoop.ipc.RpcPayloadHeader.*;
|
|
import org.apache.hadoop.io.IOUtils;
|
|
import org.apache.hadoop.io.IOUtils;
|
|
import org.apache.hadoop.io.Text;
|
|
import org.apache.hadoop.io.Text;
|
|
@@ -224,6 +225,8 @@ public class Client {
|
|
private int maxIdleTime; //connections will be culled if it was idle for
|
|
private int maxIdleTime; //connections will be culled if it was idle for
|
|
//maxIdleTime msecs
|
|
//maxIdleTime msecs
|
|
private int maxRetries; //the max. no. of retries for socket connections
|
|
private int maxRetries; //the max. no. of retries for socket connections
|
|
|
|
+ // the max. no. of retries for socket connections on time out exceptions
|
|
|
|
+ private int maxRetriesOnSocketTimeouts;
|
|
private boolean tcpNoDelay; // if T then disable Nagle's Algorithm
|
|
private boolean tcpNoDelay; // if T then disable Nagle's Algorithm
|
|
private boolean doPing; //do we need to send ping message
|
|
private boolean doPing; //do we need to send ping message
|
|
private int pingInterval; // how often sends ping to the server in msecs
|
|
private int pingInterval; // how often sends ping to the server in msecs
|
|
@@ -247,6 +250,7 @@ public class Client {
|
|
this.rpcTimeout = remoteId.getRpcTimeout();
|
|
this.rpcTimeout = remoteId.getRpcTimeout();
|
|
this.maxIdleTime = remoteId.getMaxIdleTime();
|
|
this.maxIdleTime = remoteId.getMaxIdleTime();
|
|
this.maxRetries = remoteId.getMaxRetries();
|
|
this.maxRetries = remoteId.getMaxRetries();
|
|
|
|
+ this.maxRetriesOnSocketTimeouts = remoteId.getMaxRetriesOnSocketTimeouts();
|
|
this.tcpNoDelay = remoteId.getTcpNoDelay();
|
|
this.tcpNoDelay = remoteId.getTcpNoDelay();
|
|
this.doPing = remoteId.getDoPing();
|
|
this.doPing = remoteId.getDoPing();
|
|
this.pingInterval = remoteId.getPingInterval();
|
|
this.pingInterval = remoteId.getPingInterval();
|
|
@@ -475,11 +479,8 @@ public class Client {
|
|
if (updateAddress()) {
|
|
if (updateAddress()) {
|
|
timeoutFailures = ioFailures = 0;
|
|
timeoutFailures = ioFailures = 0;
|
|
}
|
|
}
|
|
- /*
|
|
|
|
- * The max number of retries is 45, which amounts to 20s*45 = 15
|
|
|
|
- * minutes retries.
|
|
|
|
- */
|
|
|
|
- handleConnectionFailure(timeoutFailures++, 45, toe);
|
|
|
|
|
|
+ handleConnectionFailure(timeoutFailures++,
|
|
|
|
+ maxRetriesOnSocketTimeouts, toe);
|
|
} catch (IOException ie) {
|
|
} catch (IOException ie) {
|
|
if (updateAddress()) {
|
|
if (updateAddress()) {
|
|
timeoutFailures = ioFailures = 0;
|
|
timeoutFailures = ioFailures = 0;
|
|
@@ -1263,6 +1264,8 @@ public class Client {
|
|
private int maxIdleTime; //connections will be culled if it was idle for
|
|
private int maxIdleTime; //connections will be culled if it was idle for
|
|
//maxIdleTime msecs
|
|
//maxIdleTime msecs
|
|
private int maxRetries; //the max. no. of retries for socket connections
|
|
private int maxRetries; //the max. no. of retries for socket connections
|
|
|
|
+ // the max. no. of retries for socket connections on time out exceptions
|
|
|
|
+ private int maxRetriesOnSocketTimeouts;
|
|
private boolean tcpNoDelay; // if T then disable Nagle's Algorithm
|
|
private boolean tcpNoDelay; // if T then disable Nagle's Algorithm
|
|
private boolean doPing; //do we need to send ping message
|
|
private boolean doPing; //do we need to send ping message
|
|
private int pingInterval; // how often sends ping to the server in msecs
|
|
private int pingInterval; // how often sends ping to the server in msecs
|
|
@@ -1270,8 +1273,8 @@ public class Client {
|
|
ConnectionId(InetSocketAddress address, Class<?> protocol,
|
|
ConnectionId(InetSocketAddress address, Class<?> protocol,
|
|
UserGroupInformation ticket, int rpcTimeout,
|
|
UserGroupInformation ticket, int rpcTimeout,
|
|
String serverPrincipal, int maxIdleTime,
|
|
String serverPrincipal, int maxIdleTime,
|
|
- int maxRetries, boolean tcpNoDelay,
|
|
|
|
- boolean doPing, int pingInterval) {
|
|
|
|
|
|
+ int maxRetries, int maxRetriesOnSocketTimeouts,
|
|
|
|
+ boolean tcpNoDelay, boolean doPing, int pingInterval) {
|
|
this.protocol = protocol;
|
|
this.protocol = protocol;
|
|
this.address = address;
|
|
this.address = address;
|
|
this.ticket = ticket;
|
|
this.ticket = ticket;
|
|
@@ -1279,6 +1282,7 @@ public class Client {
|
|
this.serverPrincipal = serverPrincipal;
|
|
this.serverPrincipal = serverPrincipal;
|
|
this.maxIdleTime = maxIdleTime;
|
|
this.maxIdleTime = maxIdleTime;
|
|
this.maxRetries = maxRetries;
|
|
this.maxRetries = maxRetries;
|
|
|
|
+ this.maxRetriesOnSocketTimeouts = maxRetriesOnSocketTimeouts;
|
|
this.tcpNoDelay = tcpNoDelay;
|
|
this.tcpNoDelay = tcpNoDelay;
|
|
this.doPing = doPing;
|
|
this.doPing = doPing;
|
|
this.pingInterval = pingInterval;
|
|
this.pingInterval = pingInterval;
|
|
@@ -1312,6 +1316,11 @@ public class Client {
|
|
return maxRetries;
|
|
return maxRetries;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /** max connection retries on socket time outs */
|
|
|
|
+ public int getMaxRetriesOnSocketTimeouts() {
|
|
|
|
+ return maxRetriesOnSocketTimeouts;
|
|
|
|
+ }
|
|
|
|
+
|
|
boolean getTcpNoDelay() {
|
|
boolean getTcpNoDelay() {
|
|
return tcpNoDelay;
|
|
return tcpNoDelay;
|
|
}
|
|
}
|
|
@@ -1343,6 +1352,9 @@ public class Client {
|
|
rpcTimeout, remotePrincipal,
|
|
rpcTimeout, remotePrincipal,
|
|
conf.getInt("ipc.client.connection.maxidletime", 10000), // 10s
|
|
conf.getInt("ipc.client.connection.maxidletime", 10000), // 10s
|
|
conf.getInt("ipc.client.connect.max.retries", 10),
|
|
conf.getInt("ipc.client.connect.max.retries", 10),
|
|
|
|
+ conf.getInt(
|
|
|
|
+ CommonConfigurationKeysPublic.IPC_CLIENT_CONNECT_MAX_RETRIES_ON_SOCKET_TIMEOUTS_KEY,
|
|
|
|
+ CommonConfigurationKeysPublic.IPC_CLIENT_CONNECT_MAX_RETRIES_ON_SOCKET_TIMEOUTS_DEFAULT),
|
|
conf.getBoolean("ipc.client.tcpnodelay", false),
|
|
conf.getBoolean("ipc.client.tcpnodelay", false),
|
|
doPing,
|
|
doPing,
|
|
(doPing ? Client.getPingInterval(conf) : 0));
|
|
(doPing ? Client.getPingInterval(conf) : 0));
|