hadoop-hdfs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From omal...@apache.org
Subject svn commit: r1089318 - in /hadoop/hdfs/branches/yahoo-merge: CHANGES.txt src/java/org/apache/hadoop/hdfs/server/namenode/FSEditLog.java src/java/org/apache/hadoop/hdfs/server/namenode/FSImage.java
Date Wed, 06 Apr 2011 06:22:39 GMT
Author: omalley
Date: Wed Apr  6 06:22:39 2011
New Revision: 1089318

URL: http://svn.apache.org/viewvc?rev=1089318&view=rev
Log:
commit 8fbc6cdcf7cb8e071e5aed64a86796a4392bc613
Author: Owen O'Malley <omalley@apache.org>
Date:   Tue Apr 5 15:57:19 2011 -0700

    HDFS-1602. fix testStorageRestore (boryas)
    
    Conflicts:
    
    	YAHOO-CHANGES.txt

Modified:
    hadoop/hdfs/branches/yahoo-merge/CHANGES.txt
    hadoop/hdfs/branches/yahoo-merge/src/java/org/apache/hadoop/hdfs/server/namenode/FSEditLog.java
    hadoop/hdfs/branches/yahoo-merge/src/java/org/apache/hadoop/hdfs/server/namenode/FSImage.java

Modified: hadoop/hdfs/branches/yahoo-merge/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/yahoo-merge/CHANGES.txt?rev=1089318&r1=1089317&r2=1089318&view=diff
==============================================================================
--- hadoop/hdfs/branches/yahoo-merge/CHANGES.txt (original)
+++ hadoop/hdfs/branches/yahoo-merge/CHANGES.txt Wed Apr  6 06:22:39 2011
@@ -255,6 +255,8 @@ Trunk (unreleased changes)
     HDFS-1809. Missing DefaultMetricsSystem initialization breaks some tests.
     (suresh)
 
+    HDFS-1602. Fix testStorageRestore (boryas)
+
 Release 0.22.0 - Unreleased
 
   NEW FEATURES

Modified: hadoop/hdfs/branches/yahoo-merge/src/java/org/apache/hadoop/hdfs/server/namenode/FSEditLog.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/yahoo-merge/src/java/org/apache/hadoop/hdfs/server/namenode/FSEditLog.java?rev=1089318&r1=1089317&r2=1089318&view=diff
==============================================================================
--- hadoop/hdfs/branches/yahoo-merge/src/java/org/apache/hadoop/hdfs/server/namenode/FSEditLog.java
(original)
+++ hadoop/hdfs/branches/yahoo-merge/src/java/org/apache/hadoop/hdfs/server/namenode/FSEditLog.java
Wed Apr  6 06:22:39 2011
@@ -873,7 +873,9 @@ public class FSEditLog {
       return; // nothing to do, edits.new exists!
 
     // check if any of failed storage is now available and put it back
-    fsimage.attemptRestoreRemovedStorage();
+    // but don't save the current image to it 
+    // (it will be put there as a part of checkpointing)
+    fsimage.attemptRestoreRemovedStorage(false);
 
     divertFileStreams(
         Storage.STORAGE_DIR_CURRENT + "/" + NameNodeFile.EDITS_NEW.getName());

Modified: hadoop/hdfs/branches/yahoo-merge/src/java/org/apache/hadoop/hdfs/server/namenode/FSImage.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/yahoo-merge/src/java/org/apache/hadoop/hdfs/server/namenode/FSImage.java?rev=1089318&r1=1089317&r2=1089318&view=diff
==============================================================================
--- hadoop/hdfs/branches/yahoo-merge/src/java/org/apache/hadoop/hdfs/server/namenode/FSImage.java
(original)
+++ hadoop/hdfs/branches/yahoo-merge/src/java/org/apache/hadoop/hdfs/server/namenode/FSImage.java
Wed Apr  6 06:22:39 2011
@@ -1674,13 +1674,23 @@ public class FSImage extends Storage {
     return bpid;
   }
   
-  /** Create new dfs name directory.  Caution: this destroys all files
-   * in this filesystem. */
+  /**
+   *  Create new dfs name directory.  Caution: this destroys all files
+   * in this filesystem. 
+   * */
   void format(StorageDirectory sd) throws IOException {
+    format(sd, true);
+  }
+  
+  /**
+   *  if saveCurrent is true - save current image to the SD 
+   */
+  void format(StorageDirectory sd, boolean saveCurrent) throws IOException {
     sd.clearDirectory(); // create currrent dir
     sd.lock();
     try {
-      saveCurrent(sd);
+      if(saveCurrent)
+        saveCurrent(sd);
     } finally {
       sd.unlock();
     }
@@ -2150,8 +2160,10 @@ 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;
   }
@@ -2160,7 +2172,7 @@ public class FSImage extends Storage {
    * See if any of removed storages iw "writable" again, and can be returned 
    * into service
    */
-  synchronized void attemptRestoreRemovedStorage() {   
+  synchronized void attemptRestoreRemovedStorage(boolean saveCurrentImage) {   
     // if directory is "alive" - copy the images there...
     if(!restoreFailedStorage || removedStorageDirs.size() == 0) 
       return; //nothing to restore
@@ -2175,7 +2187,7 @@ public class FSImage extends Storage {
       try {
         
         if(root.exists() && root.canWrite()) { 
-          format(sd);
+          format(sd, saveCurrentImage);
           LOG.info("restoring dir " + sd.getRoot().getAbsolutePath());
           if(sd.getStorageDirType().isOfType(NameNodeDirType.EDITS)) {
             File eFile = getEditFile(sd);



Mime
View raw message