HDFS-5251. Race between the initialization of NameNode and the http server. Contributed by Haohui Mai.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1525787 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Suresh Srinivas 2013-09-24 05:31:02 +00:00
parent e3088e4aef
commit b838ac89a6
3 changed files with 19 additions and 2 deletions

View File

@ -327,6 +327,9 @@ Release 2.2.0 - UNRELEASED
HDFS-5139. Remove redundant -R option from setrep. HDFS-5139. Remove redundant -R option from setrep.
HDFS-5251. Race between the initialization of NameNode and the http
server. (Haohui Mai via suresh)
Release 2.1.1-beta - 2013-09-23 Release 2.1.1-beta - 2013-09-23
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -101,6 +101,10 @@ static String getSecurityModeText() {
} }
static String getRollingUpgradeText(FSNamesystem fsn) { static String getRollingUpgradeText(FSNamesystem fsn) {
if (fsn == null) {
return "";
}
DatanodeManager dm = fsn.getBlockManager().getDatanodeManager(); DatanodeManager dm = fsn.getBlockManager().getDatanodeManager();
Map<String, Integer> list = dm.getDatanodesSoftwareVersions(); Map<String, Integer> list = dm.getDatanodesSoftwareVersions();
if(list.size() > 1) { if(list.size() > 1) {

View File

@ -18,8 +18,13 @@
package org.apache.hadoop.hdfs.server.namenode; package org.apache.hadoop.hdfs.server.namenode;
import static org.apache.hadoop.hdfs.server.namenode.startupprogress.Phase.*; import static org.apache.hadoop.hdfs.server.namenode.startupprogress.Phase.LOADING_EDITS;
import static org.mockito.Mockito.*; import static org.apache.hadoop.hdfs.server.namenode.startupprogress.Phase.LOADING_FSIMAGE;
import static org.apache.hadoop.hdfs.server.namenode.startupprogress.Phase.SAFEMODE;
import static org.apache.hadoop.hdfs.server.namenode.startupprogress.Phase.SAVING_CHECKPOINT;
import static org.mockito.Mockito.atLeastOnce;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
@ -107,6 +112,11 @@ public void testGenerateStartupProgress() throws Exception {
Assert.assertTrue(containsMatch(contents, SAFEMODE.getDescription())); Assert.assertTrue(containsMatch(contents, SAFEMODE.getDescription()));
} }
@Test
public void testGetRollingUpgradeText() {
Assert.assertEquals("", NamenodeJspHelper.getRollingUpgradeText(null));
}
/** /**
* Checks if the list contains any string that partially matches the regex. * Checks if the list contains any string that partially matches the regex.
* *