HDFS-2724. NN web UI can throw NPE after startup, before standby state is entered. Contributed by Todd Lipcon.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/HDFS-1623@1229466 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Todd Lipcon 2012-01-10 03:46:05 +00:00
parent 526efb48a6
commit 44d070cd01
4 changed files with 9 additions and 2 deletions

View File

@ -36,9 +36,11 @@ public interface HAServiceProtocol extends VersionedProtocol {
public static final long versionID = 1L;
/**
* An HA service may be in active or standby state.
* An HA service may be in active or standby state. During
* startup, it is in an unknown INITIALIZING state.
*/
public enum HAServiceState {
INITIALIZING("initializing"),
ACTIVE("active"),
STANDBY("standby");

View File

@ -91,3 +91,5 @@ HDFS-2709. Appropriately handle error conditions in EditLogTailer (atm via todd)
HDFS-2730. Refactor shared HA-related test code into HATestUtil class (todd)
HDFS-2762. Fix TestCheckpoint timing out on HA branch. (Uma Maheswara Rao G via todd)
HDFS-2724. NN web UI can throw NPE after startup, before standby state is entered. (todd)

View File

@ -926,6 +926,9 @@ public class NameNode {
}
synchronized HAServiceState getServiceState() {
if (state == null) {
return HAServiceState.INITIALIZING;
}
return state.getServiceState();
}

View File

@ -31,7 +31,7 @@
NameNode nn = NameNodeHttpServer.getNameNodeFromContext(application);
FSNamesystem fsn = nn.getNamesystem();
String namenodeRole = nn.getRole().toString();
String namenodeState = HAServiceState.ACTIVE.equals(nn.getServiceState()) ? "active" : "standby";
String namenodeState = nn.getServiceState().toString();
String namenodeLabel = nn.getNameNodeAddress().getHostName() + ":" + nn.getNameNodeAddress().getPort();
%>