diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index 15aa5efd41e..c9b57a1ab7b 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -89,6 +89,9 @@ Release 2.2.0 - UNRELEASED 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 INCOMPATIBLE CHANGES diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NamenodeJspHelper.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NamenodeJspHelper.java index d76f963ee35..461dacc986b 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NamenodeJspHelper.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NamenodeJspHelper.java @@ -101,6 +101,10 @@ class NamenodeJspHelper { } static String getRollingUpgradeText(FSNamesystem fsn) { + if (fsn == null) { + return ""; + } + DatanodeManager dm = fsn.getBlockManager().getDatanodeManager(); Map list = dm.getDatanodesSoftwareVersions(); if(list.size() > 1) { diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestNameNodeJspHelper.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestNameNodeJspHelper.java index 8119d662a6f..a847a9438a3 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestNameNodeJspHelper.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestNameNodeJspHelper.java @@ -18,8 +18,13 @@ package org.apache.hadoop.hdfs.server.namenode; -import static org.apache.hadoop.hdfs.server.namenode.startupprogress.Phase.*; -import static org.mockito.Mockito.*; +import static org.apache.hadoop.hdfs.server.namenode.startupprogress.Phase.LOADING_EDITS; +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.util.List; @@ -107,6 +112,11 @@ public class TestNameNodeJspHelper { 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. *