hadoop-hdfs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bor...@apache.org
Subject svn commit: r1069560 - in /hadoop/hdfs/branches/branch-0.22: CHANGES.txt src/java/org/apache/hadoop/hdfs/server/namenode/FSImage.java
Date Thu, 10 Feb 2011 20:32:26 GMT
Author: boryas
Date: Thu Feb 10 20:32:26 2011
New Revision: 1069560

URL: http://svn.apache.org/viewvc?rev=1069560&view=rev
Log:
HDFS-1602. Fix HADOOP-4885 for it is doesn't work as expected.

Modified:
    hadoop/hdfs/branches/branch-0.22/CHANGES.txt
    hadoop/hdfs/branches/branch-0.22/src/java/org/apache/hadoop/hdfs/server/namenode/FSImage.java

Modified: hadoop/hdfs/branches/branch-0.22/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/branch-0.22/CHANGES.txt?rev=1069560&r1=1069559&r2=1069560&view=diff
==============================================================================
--- hadoop/hdfs/branches/branch-0.22/CHANGES.txt (original)
+++ hadoop/hdfs/branches/branch-0.22/CHANGES.txt Thu Feb 10 20:32:26 2011
@@ -240,6 +240,8 @@ Release 0.22.0 - Unreleased
     HDFS-1434. Refactor Datanode#startDataNode method into smaller methods.
     (suresh)
 
+    HDFS-1602. Fix HADOOP-4885 for it is doesn't work as expected. (boryas)
+
   BUG FIXES
 
     HDFS-1039. Adding test for  JspHelper.getUGI(jnp via boryas)

Modified: hadoop/hdfs/branches/branch-0.22/src/java/org/apache/hadoop/hdfs/server/namenode/FSImage.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/branch-0.22/src/java/org/apache/hadoop/hdfs/server/namenode/FSImage.java?rev=1069560&r1=1069559&r2=1069560&view=diff
==============================================================================
--- hadoop/hdfs/branches/branch-0.22/src/java/org/apache/hadoop/hdfs/server/namenode/FSImage.java
(original)
+++ hadoop/hdfs/branches/branch-0.22/src/java/org/apache/hadoop/hdfs/server/namenode/FSImage.java
Thu Feb 10 20:32:26 2011
@@ -1602,8 +1602,9 @@ public class FSImage extends Storage {
     for (Iterator<StorageDirectory> it = 
       dirIterator(NameNodeDirType.IMAGE); it.hasNext();) {
       sd = it.next();
-      if(sd.getRoot().canRead())
-        return getImageFile(sd, NameNodeFile.IMAGE); 
+      File fsImage = getImageFile(sd, NameNodeFile.IMAGE);
+      if(sd.getRoot().canRead() && fsImage.exists())
+        return fsImage;
     }
     return null;
   }
@@ -1627,7 +1628,10 @@ public class FSImage extends Storage {
       try {
         
         if(root.exists() && root.canWrite()) { 
-          format(sd);
+          // when we try to restore we just need to remove all the data
+          // without saving current in-memory state (which could've changed).
+          sd.clearDirectory();
+          
           LOG.info("restoring dir " + sd.getRoot().getAbsolutePath());
           if(sd.getStorageDirType().isOfType(NameNodeDirType.EDITS)) {
             File eFile = getEditFile(sd);



Mime
View raw message