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:
parent
526efb48a6
commit
44d070cd01
|
@ -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");
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -926,6 +926,9 @@ public class NameNode {
|
|||
}
|
||||
|
||||
synchronized HAServiceState getServiceState() {
|
||||
if (state == null) {
|
||||
return HAServiceState.INITIALIZING;
|
||||
}
|
||||
return state.getServiceState();
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
%>
|
||||
|
||||
|
|
Loading…
Reference in New Issue