HDFS-6731. Run 'hdfs zkfc -formatZK' on a server in a non-namenode will cause a null pointer exception. Contributed by Masatake Iwasaki

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1612715 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brandon Li 2014-07-22 22:29:04 +00:00
parent c5686addb1
commit 853ed29f2d
2 changed files with 8 additions and 0 deletions

View File

@ -354,6 +354,9 @@ Release 2.6.0 - UNRELEASED
HDFS-6704. Fix the command to launch JournalNode in HDFS-HA document.
(Akira AJISAKA via jing9)
HDFS-6731. Run "hdfs zkfc-formatZK" on a server in a non-namenode will cause
a null pointer exception. (Masatake Iwasaki via brandonli)
Release 2.5.0 - UNRELEASED
INCOMPATIBLE CHANGES

View File

@ -122,6 +122,11 @@ public class DFSZKFailoverController extends ZKFailoverController {
"HA is not enabled for this namenode.");
}
String nnId = HAUtil.getNameNodeId(localNNConf, nsId);
if (nnId == null) {
String msg = "Could not get the namenode ID of this node. " +
"You may run zkfc on the node other than namenode.";
throw new HadoopIllegalArgumentException(msg);
}
NameNode.initializeGenericKeys(localNNConf, nsId, nnId);
DFSUtil.setGenericConf(localNNConf, nsId, nnId, ZKFC_CONF_KEYS);