hadoop-hdfs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bor...@apache.org
Subject svn commit: r1068230 - in /hadoop/hdfs/trunk: CHANGES.txt src/java/org/apache/hadoop/hdfs/server/namenode/FSEditLog.java src/java/org/apache/hadoop/hdfs/server/namenode/FSImage.java src/java/org/apache/hadoop/hdfs/server/namenode/NNStorage.java
Date Tue, 08 Feb 2011 00:06:06 GMT
Author: boryas
Date: Tue Feb  8 00:06:06 2011
New Revision: 1068230

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

Modified:
    hadoop/hdfs/trunk/CHANGES.txt
    hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/FSEditLog.java
    hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/FSImage.java
    hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/NNStorage.java

Modified: hadoop/hdfs/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/CHANGES.txt?rev=1068230&r1=1068229&r2=1068230&view=diff
==============================================================================
--- hadoop/hdfs/trunk/CHANGES.txt (original)
+++ hadoop/hdfs/trunk/CHANGES.txt Tue Feb  8 00:06:06 2011
@@ -87,6 +87,8 @@ Trunk (unreleased changes)
     HDFS-1607. Fix referenced to misspelled method name getProtocolSigature
     (todd)
 
+    HDFS-1602. Fix HADOOP-4885 for it is doesn't work as expected. (boryas)
+
 Release 0.22.0 - Unreleased
 
   NEW FEATURES

Modified: hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/FSEditLog.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/FSEditLog.java?rev=1068230&r1=1068229&r2=1068230&view=diff
==============================================================================
--- hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/FSEditLog.java (original)
+++ hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/FSEditLog.java Tue Feb
 8 00:06:06 2011
@@ -805,7 +805,7 @@ public class FSEditLog implements NNStor
       return; // nothing to do, edits.new exists!
 
     // check if any of failed storage is now available and put it back
-    storage.attemptRestoreRemovedStorage(false);
+    storage.attemptRestoreRemovedStorage();
 
     divertFileStreams(
         Storage.STORAGE_DIR_CURRENT + "/" + NameNodeFile.EDITS_NEW.getName());

Modified: hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/FSImage.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/FSImage.java?rev=1068230&r1=1068229&r2=1068230&view=diff
==============================================================================
--- hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/FSImage.java (original)
+++ hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/FSImage.java Tue Feb
 8 00:06:06 2011
@@ -787,7 +787,7 @@ public class FSImage implements NNStorag
  
     // try to restore all failed edit logs here
     assert editLog != null : "editLog must be initialized";
-    storage.attemptRestoreRemovedStorage(true);
+    storage.attemptRestoreRemovedStorage();
 
     editLog.close();
     if(renewCheckpointTime)

Modified: hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/NNStorage.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/NNStorage.java?rev=1068230&r1=1068229&r2=1068230&view=diff
==============================================================================
--- hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/NNStorage.java (original)
+++ hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/NNStorage.java Tue Feb
 8 00:06:06 2011
@@ -217,7 +217,7 @@ public class NNStorage extends Storage i
    *
    * @param saveNamespace Whether method is being called from saveNamespace()
    */
-  void attemptRestoreRemovedStorage(boolean saveNamespace) {
+  void attemptRestoreRemovedStorage() {
     // if directory is "alive" - copy the images there...
     if(!restoreFailedStorage || removedStorageDirs.size() == 0)
       return; //nothing to restore
@@ -236,15 +236,9 @@ public class NNStorage extends Storage i
         try {
           
           if(root.exists() && root.canWrite()) {
-            /** If this call is being made from savenamespace command, then no
-             * need to format, the savenamespace command will format and write
-             * the new image to this directory anyways.
-             */
-            if (saveNamespace) {
-              sd.clearDirectory();
-            } else {
-              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());
             for (NNStorageListener listener : listeners) {
@@ -523,8 +517,9 @@ public class NNStorage extends Storage i
     for (Iterator<StorageDirectory> it =
       dirIterator(NameNodeDirType.IMAGE); it.hasNext();) {
       sd = it.next();
-      if(sd.getRoot().canRead())
-        return getStorageFile(sd, NameNodeFile.IMAGE);
+      File fsImage = getStorageFile(sd, NameNodeFile.IMAGE);
+      if(sd.getRoot().canRead() && fsImage.exists())
+        return fsImage;
     }
     return null;
   }



Mime
View raw message