HADOOP-8243. Security support broken in CLI (manual) failover controller. Contributed by Todd Lipcon.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1309135 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
1f4197984c
commit
84ff2d6d06
@ -314,6 +314,9 @@ Release 2.0.0 - UNRELEASED
|
|||||||
HADOOP-8238. NetUtils#getHostNameOfIP blows up if given ip:port
|
HADOOP-8238. NetUtils#getHostNameOfIP blows up if given ip:port
|
||||||
string w/o port. (eli)
|
string w/o port. (eli)
|
||||||
|
|
||||||
|
HADOOP-8243. Security support broken in CLI (manual) failover controller
|
||||||
|
(todd)
|
||||||
|
|
||||||
BREAKDOWN OF HADOOP-7454 SUBTASKS
|
BREAKDOWN OF HADOOP-7454 SUBTASKS
|
||||||
|
|
||||||
HADOOP-7455. HA: Introduce HA Service Protocol Interface. (suresh)
|
HADOOP-7455. HA: Introduce HA Service Protocol Interface. (suresh)
|
||||||
|
@ -52,14 +52,22 @@ public class FailoverController {
|
|||||||
public FailoverController(Configuration conf) {
|
public FailoverController(Configuration conf) {
|
||||||
this.conf = conf;
|
this.conf = conf;
|
||||||
|
|
||||||
this.gracefulFenceTimeout = conf.getInt(
|
this.gracefulFenceTimeout = getGracefulFenceTimeout(conf);
|
||||||
|
this.rpcTimeoutToNewActive = getRpcTimeoutToNewActive(conf);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int getGracefulFenceTimeout(Configuration conf) {
|
||||||
|
return conf.getInt(
|
||||||
CommonConfigurationKeys.HA_FC_GRACEFUL_FENCE_TIMEOUT_KEY,
|
CommonConfigurationKeys.HA_FC_GRACEFUL_FENCE_TIMEOUT_KEY,
|
||||||
CommonConfigurationKeys.HA_FC_GRACEFUL_FENCE_TIMEOUT_DEFAULT);
|
CommonConfigurationKeys.HA_FC_GRACEFUL_FENCE_TIMEOUT_DEFAULT);
|
||||||
this.rpcTimeoutToNewActive = conf.getInt(
|
}
|
||||||
|
|
||||||
|
static int getRpcTimeoutToNewActive(Configuration conf) {
|
||||||
|
return conf.getInt(
|
||||||
CommonConfigurationKeys.HA_FC_NEW_ACTIVE_TIMEOUT_KEY,
|
CommonConfigurationKeys.HA_FC_NEW_ACTIVE_TIMEOUT_KEY,
|
||||||
CommonConfigurationKeys.HA_FC_NEW_ACTIVE_TIMEOUT_DEFAULT);
|
CommonConfigurationKeys.HA_FC_NEW_ACTIVE_TIMEOUT_DEFAULT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Perform pre-failover checks on the given service we plan to
|
* Perform pre-failover checks on the given service we plan to
|
||||||
* failover to, eg to prevent failing over to a service (eg due
|
* failover to, eg to prevent failing over to a service (eg due
|
||||||
|
@ -114,7 +114,8 @@ private int transitionToActive(final String[] argv)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
HAServiceProtocol proto = resolveTarget(argv[1]).getProxy();
|
HAServiceProtocol proto = resolveTarget(argv[1]).getProxy(
|
||||||
|
getConf(), 0);
|
||||||
HAServiceProtocolHelper.transitionToActive(proto);
|
HAServiceProtocolHelper.transitionToActive(proto);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -127,7 +128,8 @@ private int transitionToStandby(final String[] argv)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
HAServiceProtocol proto = resolveTarget(argv[1]).getProxy();
|
HAServiceProtocol proto = resolveTarget(argv[1]).getProxy(
|
||||||
|
getConf(), 0);
|
||||||
HAServiceProtocolHelper.transitionToStandby(proto);
|
HAServiceProtocolHelper.transitionToStandby(proto);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -68,11 +68,4 @@ public HAServiceProtocol getProxy(Configuration conf, int timeoutMs)
|
|||||||
getAddress(),
|
getAddress(),
|
||||||
confCopy, factory, timeoutMs);
|
confCopy, factory, timeoutMs);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return a proxy to connect to the target HA Service.
|
|
||||||
*/
|
|
||||||
public final HAServiceProtocol getProxy() throws IOException {
|
|
||||||
return getProxy(new Configuration(), 0); // default conf, timeout
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -245,7 +245,8 @@ private synchronized void fatalError(String err) {
|
|||||||
private synchronized void becomeActive() {
|
private synchronized void becomeActive() {
|
||||||
LOG.info("Trying to make " + localTarget + " active...");
|
LOG.info("Trying to make " + localTarget + " active...");
|
||||||
try {
|
try {
|
||||||
localTarget.getProxy().transitionToActive();
|
HAServiceProtocolHelper.transitionToActive(localTarget.getProxy(
|
||||||
|
conf, FailoverController.getRpcTimeoutToNewActive(conf)));
|
||||||
LOG.info("Successfully transitioned " + localTarget +
|
LOG.info("Successfully transitioned " + localTarget +
|
||||||
" to active state");
|
" to active state");
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
@ -267,7 +268,8 @@ private synchronized void becomeStandby() {
|
|||||||
LOG.info("ZK Election indicated that " + localTarget +
|
LOG.info("ZK Election indicated that " + localTarget +
|
||||||
" should become standby");
|
" should become standby");
|
||||||
try {
|
try {
|
||||||
localTarget.getProxy().transitionToStandby();
|
int timeout = FailoverController.getGracefulFenceTimeout(conf);
|
||||||
|
localTarget.getProxy(conf, timeout).transitionToStandby();
|
||||||
LOG.info("Successfully transitioned " + localTarget +
|
LOG.info("Successfully transitioned " + localTarget +
|
||||||
" to standby state");
|
" to standby state");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user