HDFS-3200. Scope all ZKFC configurations by nameservice. Contributed by Todd Lipcon.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/HDFS-3042@1310165 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Todd Lipcon 2012-04-06 04:27:44 +00:00
parent 00a1548005
commit 844faefd08
4 changed files with 19 additions and 2 deletions

View File

@ -44,7 +44,6 @@ public abstract class ZKFailoverController implements Tool {
static final Log LOG = LogFactory.getLog(ZKFailoverController.class);
// TODO: this should be namespace-scoped
public static final String ZK_QUORUM_KEY = "ha.zookeeper.quorum";
private static final String ZK_SESSION_TIMEOUT_KEY = "ha.zookeeper.session-timeout.ms";
private static final int ZK_SESSION_TIMEOUT_DEFAULT = 5*1000;
@ -54,6 +53,19 @@ public abstract class ZKFailoverController implements Tool {
public static final String ZK_AUTH_KEY = "ha.zookeeper.auth";
static final String ZK_PARENT_ZNODE_DEFAULT = "/hadoop-ha";
/**
* All of the conf keys used by the ZKFC. This is used in order to allow
* them to be overridden on a per-nameservice or per-namenode basis.
*/
protected static final String[] ZKFC_CONF_KEYS = new String[] {
ZK_QUORUM_KEY,
ZK_SESSION_TIMEOUT_KEY,
ZK_PARENT_ZNODE_KEY,
ZK_ACL_KEY,
ZK_AUTH_KEY
};
/** Unable to format the parent znode in ZK */
static final int ERR_CODE_FORMAT_DENIED = 2;
/** The parent znode doesn't exist in ZK */

View File

@ -5,3 +5,5 @@ branch is merged.
------------------------------
HDFS-2185. HDFS portion of ZK-based FailoverController (todd)
HDFS-3200. Scope all ZKFC configurations by nameservice (todd)

View File

@ -94,6 +94,7 @@ public class DFSZKFailoverController extends ZKFailoverController {
}
String nnId = HAUtil.getNameNodeId(localNNConf, nsId);
NameNode.initializeGenericKeys(localNNConf, nsId, nnId);
DFSUtil.setGenericConf(localNNConf, nsId, nnId, ZKFC_CONF_KEYS);
localTarget = new NNHAServiceTarget(localNNConf, nsId, nnId);

View File

@ -53,7 +53,9 @@ public class TestDFSZKFailoverController extends ClientBaseWithFixes {
@Before
public void setup() throws Exception {
conf = new Configuration();
conf.set(ZKFailoverController.ZK_QUORUM_KEY, hostPort);
// Specify the quorum per-nameservice, to ensure that these configs
// can be nameservice-scoped.
conf.set(ZKFailoverController.ZK_QUORUM_KEY + ".ns1", hostPort);
conf.set(NodeFencer.CONF_METHODS_KEY,
AlwaysSucceedFencer.class.getName());