Parcourir la source

HDFS-686. NullPointerException is thrown while merging edit log and image. Contributed by Hairong Kuang.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/hdfs/trunk@824944 13f79535-47bb-0310-9956-ffa450edef68
Hairong Kuang il y a 16 ans
Parent
commit
25a63f87b9

+ 7 - 0
CHANGES.txt

@@ -397,6 +397,13 @@ Release 0.21.0 - Unreleased
     HDFS-673. BlockReceiver#PacketResponder should not remove a packet from
     the ack queue before its ack is sent. (hairong)
 
+Release 0.20.2 - Unreleased
+
+  BUG FIXES
+
+    HDFS-686. NullPointerException is thrown while merging edit log and image.
+    (hairong)
+
 Release 0.20.1 - 2009-09-01
 
   IMPROVEMENTS

+ 4 - 5
src/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java

@@ -700,10 +700,7 @@ public class FSNamesystem implements FSConstants, FSNamesystemMBean, FSClusterSt
     if (length < 0) {
       throw new IOException("Negative length is not supported. File: " + src );
     }
-    INodeFile inode = dir.getFileINode(src);
-    if (inode == null)
-      throw new FileNotFoundException();
-    final LocatedBlocks ret = getBlockLocationsInternal(src, inode,
+    final LocatedBlocks ret = getBlockLocationsInternal(src,
         offset, length, doAccessTime);  
     if (auditLog.isInfoEnabled()) {
       logAuditEvent(UserGroupInformation.getCurrentUGI(),
@@ -714,11 +711,13 @@ public class FSNamesystem implements FSConstants, FSNamesystemMBean, FSClusterSt
   }
 
   private synchronized LocatedBlocks getBlockLocationsInternal(String src,
-                                                       INodeFile inode,
                                                        long offset, 
                                                        long length,
                                                        boolean doAccessTime
                                                        ) throws IOException {
+    INodeFile inode = dir.getFileINode(src);
+    if (inode == null)
+      throw new FileNotFoundException();
     if (doAccessTime && isAccessTimeSupported()) {
       dir.setTimes(src, inode, -1, now(), false);
     }