Author: wheat9 Date: Wed Mar 5 21:53:04 2014 New Revision: 1574685 URL: http://svn.apache.org/r1574685 Log: Merge r1574683 from trunk
Modified: hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/web/resources/NamenodeWebHdfsMethods.java Modified: hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt?rev=1574685&r1=1574684&r2=1574685&view=diff ============================================================================== --- hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt (original) +++ hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt Wed Mar 5 21:53:04 2014 @@ -297,6 +297,9 @@ Release 2.4.0 - UNRELEASED HDFS-6051. HDFS cannot run on Windows since short-circuit shared memory segment changes. (cmccabe) + HDFS-5857. TestWebHDFS#testNamenodeRestart fails intermittently with NPE. + (Mit Desai via wheat9) + BREAKDOWN OF HDFS-5698 SUBTASKS AND RELATED JIRAS HDFS-5717. Save FSImage header in protobuf. (Haohui Mai via jing9) Modified: hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/web/resources/NamenodeWebHdfsMethods.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/web/resources/NamenodeWebHdfsMethods.java?rev=1574685&r1=1574684&r2=1574685&view=diff ============================================================================== --- hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/web/resources/NamenodeWebHdfsMethods.java (original) +++ hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/web/resources/NamenodeWebHdfsMethods.java Wed Mar 5 21:53:04 2014 @@ -164,6 +164,15 @@ public class NamenodeWebHdfsMethods { response.setContentType(null); } + private static NamenodeProtocols getRPCServer(NameNode namenode) + throws IOException { + final NamenodeProtocols np = namenode.getRpcServer(); + if (np == null) { + throw new IOException("Namenode is in startup mode"); + } + return np; + } + @VisibleForTesting static DatanodeInfo chooseDatanode(final NameNode namenode, final String path, final HttpOpParam.Op op, final long openOffset, @@ -188,7 +197,7 @@ public class NamenodeWebHdfsMethods { || op == GetOpParam.Op.GETFILECHECKSUM || op == PostOpParam.Op.APPEND) { //choose a datanode containing a replica - final NamenodeProtocols np = namenode.getRpcServer(); + final NamenodeProtocols np = getRPCServer(namenode); final HdfsFileStatus status = np.getFileInfo(path); if (status == null) { throw new FileNotFoundException("File " + path + " not found."); @@ -424,7 +433,7 @@ public class NamenodeWebHdfsMethods { final Configuration conf = (Configuration)context.getAttribute(JspHelper.CURRENT_CONF); final NameNode namenode = (NameNode)context.getAttribute("name.node"); - final NamenodeProtocols np = namenode.getRpcServer(); + final NamenodeProtocols np = getRPCServer(namenode); switch(op.getValue()) { case CREATE: @@ -606,7 +615,7 @@ public class NamenodeWebHdfsMethods { } case CONCAT: { - namenode.getRpcServer().concat(fullpath, concatSrcs.getAbsolutePaths()); + getRPCServer(namenode).concat(fullpath, concatSrcs.getAbsolutePaths()); return Response.ok().build(); } default: @@ -696,7 +705,7 @@ public class NamenodeWebHdfsMethods { final BufferSizeParam bufferSize ) throws IOException, URISyntaxException { final NameNode namenode = (NameNode)context.getAttribute("name.node"); - final NamenodeProtocols np = namenode.getRpcServer(); + final NamenodeProtocols np = getRPCServer(namenode); switch(op.getValue()) { case OPEN: @@ -905,7 +914,7 @@ public class NamenodeWebHdfsMethods { switch(op.getValue()) { case DELETE: { - final boolean b = namenode.getRpcServer().delete(fullpath, recursive.getValue()); + final boolean b = getRPCServer(namenode).delete(fullpath, recursive.getValue()); final String js = JsonUtil.toJsonString("boolean", b); return Response.ok(js).type(MediaType.APPLICATION_JSON).build(); }