HDFS-2947. On startup NN throws an NPE in the metrics system. Contributed by Aaron T. Myers.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/HDFS-1623@1243826 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Aaron Myers 2012-02-14 08:42:25 +00:00
parent db187cf40e
commit 1b2ecc6336
2 changed files with 7 additions and 5 deletions

View File

@ -196,3 +196,5 @@ HDFS-2912. Namenode not shutting down when shared edits dir is inaccessible. (Bi
HDFS-2917. HA: haadmin should not work if run by regular user (eli) HDFS-2917. HA: haadmin should not work if run by regular user (eli)
HDFS-2939. TestHAStateTransitions fails on Windows. (Uma Maheswara Rao G via atm) HDFS-2939. TestHAStateTransitions fails on Windows. (Uma Maheswara Rao G via atm)
HDFS-2947. On startup NN throws an NPE in the metrics system. (atm)

View File

@ -534,16 +534,16 @@ protected NameNode(Configuration conf, NamenodeRole role)
String nsId = getNameServiceId(conf); String nsId = getNameServiceId(conf);
String namenodeId = HAUtil.getNameNodeId(conf, nsId); String namenodeId = HAUtil.getNameNodeId(conf, nsId);
this.haEnabled = HAUtil.isHAEnabled(conf, nsId); this.haEnabled = HAUtil.isHAEnabled(conf, nsId);
if (!haEnabled) {
state = ACTIVE_STATE;
} else {
state = STANDBY_STATE;;
}
this.allowStaleStandbyReads = HAUtil.shouldAllowStandbyReads(conf); this.allowStaleStandbyReads = HAUtil.shouldAllowStandbyReads(conf);
this.haContext = createHAContext(); this.haContext = createHAContext();
try { try {
initializeGenericKeys(conf, nsId, namenodeId); initializeGenericKeys(conf, nsId, namenodeId);
initialize(conf); initialize(conf);
if (!haEnabled) {
state = ACTIVE_STATE;
} else {
state = STANDBY_STATE;;
}
state.prepareToEnterState(haContext); state.prepareToEnterState(haContext);
state.enterState(haContext); state.enterState(haContext);
} catch (IOException e) { } catch (IOException e) {