HADOOP-10747. Merging change r1605219 from trunk to branch-2.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1605225 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
25cc3044ec
commit
cce688c762
@ -103,6 +103,9 @@ Release 2.5.0 - UNRELEASED
|
|||||||
HADOOP-10652. Refactor Proxyusers to use AccessControlList. (Benoy
|
HADOOP-10652. Refactor Proxyusers to use AccessControlList. (Benoy
|
||||||
Antony via Arpit Agarwal)
|
Antony via Arpit Agarwal)
|
||||||
|
|
||||||
|
HADOOP-10747. Support configurable retries on SASL connection failures in
|
||||||
|
RPC client. (cnauroth)
|
||||||
|
|
||||||
OPTIMIZATIONS
|
OPTIMIZATIONS
|
||||||
|
|
||||||
BUG FIXES
|
BUG FIXES
|
||||||
|
@ -253,6 +253,10 @@ public class CommonConfigurationKeys extends CommonConfigurationKeysPublic {
|
|||||||
public static final String IPC_CLIENT_FALLBACK_TO_SIMPLE_AUTH_ALLOWED_KEY = "ipc.client.fallback-to-simple-auth-allowed";
|
public static final String IPC_CLIENT_FALLBACK_TO_SIMPLE_AUTH_ALLOWED_KEY = "ipc.client.fallback-to-simple-auth-allowed";
|
||||||
public static final boolean IPC_CLIENT_FALLBACK_TO_SIMPLE_AUTH_ALLOWED_DEFAULT = false;
|
public static final boolean IPC_CLIENT_FALLBACK_TO_SIMPLE_AUTH_ALLOWED_DEFAULT = false;
|
||||||
|
|
||||||
|
public static final String IPC_CLIENT_CONNECT_MAX_RETRIES_ON_SASL_KEY =
|
||||||
|
"ipc.client.connect.max.retries.on.sasl";
|
||||||
|
public static final int IPC_CLIENT_CONNECT_MAX_RETRIES_ON_SASL_DEFAULT = 5;
|
||||||
|
|
||||||
/** How often the server scans for idle connections */
|
/** How often the server scans for idle connections */
|
||||||
public static final String IPC_CLIENT_CONNECTION_IDLESCANINTERVAL_KEY =
|
public static final String IPC_CLIENT_CONNECTION_IDLESCANINTERVAL_KEY =
|
||||||
"ipc.client.connection.idle-scan-interval.ms";
|
"ipc.client.connection.idle-scan-interval.ms";
|
||||||
|
@ -379,6 +379,7 @@ private class Connection extends Thread {
|
|||||||
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 final RetryPolicy connectionRetryPolicy;
|
private final RetryPolicy connectionRetryPolicy;
|
||||||
|
private final int maxRetriesOnSasl;
|
||||||
private int maxRetriesOnSocketTimeouts;
|
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
|
||||||
@ -406,6 +407,7 @@ public Connection(ConnectionId remoteId, int serviceClass) throws IOException {
|
|||||||
this.rpcTimeout = remoteId.getRpcTimeout();
|
this.rpcTimeout = remoteId.getRpcTimeout();
|
||||||
this.maxIdleTime = remoteId.getMaxIdleTime();
|
this.maxIdleTime = remoteId.getMaxIdleTime();
|
||||||
this.connectionRetryPolicy = remoteId.connectionRetryPolicy;
|
this.connectionRetryPolicy = remoteId.connectionRetryPolicy;
|
||||||
|
this.maxRetriesOnSasl = remoteId.getMaxRetriesOnSasl();
|
||||||
this.maxRetriesOnSocketTimeouts = remoteId.getMaxRetriesOnSocketTimeouts();
|
this.maxRetriesOnSocketTimeouts = remoteId.getMaxRetriesOnSocketTimeouts();
|
||||||
this.tcpNoDelay = remoteId.getTcpNoDelay();
|
this.tcpNoDelay = remoteId.getTcpNoDelay();
|
||||||
this.doPing = remoteId.getDoPing();
|
this.doPing = remoteId.getDoPing();
|
||||||
@ -693,7 +695,6 @@ private synchronized void setupIOstreams() {
|
|||||||
LOG.debug("Connecting to "+server);
|
LOG.debug("Connecting to "+server);
|
||||||
}
|
}
|
||||||
short numRetries = 0;
|
short numRetries = 0;
|
||||||
final short MAX_RETRIES = 5;
|
|
||||||
Random rand = null;
|
Random rand = null;
|
||||||
while (true) {
|
while (true) {
|
||||||
setupConnection();
|
setupConnection();
|
||||||
@ -721,8 +722,8 @@ public AuthMethod run()
|
|||||||
if (rand == null) {
|
if (rand == null) {
|
||||||
rand = new Random();
|
rand = new Random();
|
||||||
}
|
}
|
||||||
handleSaslConnectionFailure(numRetries++, MAX_RETRIES, ex, rand,
|
handleSaslConnectionFailure(numRetries++, maxRetriesOnSasl, ex,
|
||||||
ticket);
|
rand, ticket);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (authMethod != AuthMethod.SIMPLE) {
|
if (authMethod != AuthMethod.SIMPLE) {
|
||||||
@ -1478,6 +1479,7 @@ public static class ConnectionId {
|
|||||||
private final int maxIdleTime; //connections will be culled if it was idle for
|
private final int maxIdleTime; //connections will be culled if it was idle for
|
||||||
//maxIdleTime msecs
|
//maxIdleTime msecs
|
||||||
private final RetryPolicy connectionRetryPolicy;
|
private final RetryPolicy connectionRetryPolicy;
|
||||||
|
private final int maxRetriesOnSasl;
|
||||||
// the max. no. of retries for socket connections on time out exceptions
|
// the max. no. of retries for socket connections on time out exceptions
|
||||||
private final int maxRetriesOnSocketTimeouts;
|
private final int maxRetriesOnSocketTimeouts;
|
||||||
private final boolean tcpNoDelay; // if T then disable Nagle's Algorithm
|
private final boolean tcpNoDelay; // if T then disable Nagle's Algorithm
|
||||||
@ -1498,6 +1500,9 @@ public static class ConnectionId {
|
|||||||
this.maxIdleTime = conf.getInt(
|
this.maxIdleTime = conf.getInt(
|
||||||
CommonConfigurationKeysPublic.IPC_CLIENT_CONNECTION_MAXIDLETIME_KEY,
|
CommonConfigurationKeysPublic.IPC_CLIENT_CONNECTION_MAXIDLETIME_KEY,
|
||||||
CommonConfigurationKeysPublic.IPC_CLIENT_CONNECTION_MAXIDLETIME_DEFAULT);
|
CommonConfigurationKeysPublic.IPC_CLIENT_CONNECTION_MAXIDLETIME_DEFAULT);
|
||||||
|
this.maxRetriesOnSasl = conf.getInt(
|
||||||
|
CommonConfigurationKeys.IPC_CLIENT_CONNECT_MAX_RETRIES_ON_SASL_KEY,
|
||||||
|
CommonConfigurationKeys.IPC_CLIENT_CONNECT_MAX_RETRIES_ON_SASL_DEFAULT);
|
||||||
this.maxRetriesOnSocketTimeouts = conf.getInt(
|
this.maxRetriesOnSocketTimeouts = conf.getInt(
|
||||||
CommonConfigurationKeysPublic.IPC_CLIENT_CONNECT_MAX_RETRIES_ON_SOCKET_TIMEOUTS_KEY,
|
CommonConfigurationKeysPublic.IPC_CLIENT_CONNECT_MAX_RETRIES_ON_SOCKET_TIMEOUTS_KEY,
|
||||||
CommonConfigurationKeysPublic.IPC_CLIENT_CONNECT_MAX_RETRIES_ON_SOCKET_TIMEOUTS_DEFAULT);
|
CommonConfigurationKeysPublic.IPC_CLIENT_CONNECT_MAX_RETRIES_ON_SOCKET_TIMEOUTS_DEFAULT);
|
||||||
@ -1531,6 +1536,10 @@ int getMaxIdleTime() {
|
|||||||
return maxIdleTime;
|
return maxIdleTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getMaxRetriesOnSasl() {
|
||||||
|
return maxRetriesOnSasl;
|
||||||
|
}
|
||||||
|
|
||||||
/** max connection retries on socket time outs */
|
/** max connection retries on socket time outs */
|
||||||
public int getMaxRetriesOnSocketTimeouts() {
|
public int getMaxRetriesOnSocketTimeouts() {
|
||||||
return maxRetriesOnSocketTimeouts;
|
return maxRetriesOnSocketTimeouts;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user