hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s..@apache.org
Subject svn commit: r668278 - in /hadoop/core/branches/branch-0.18: CHANGES.txt src/hdfs/org/apache/hadoop/dfs/FSImage.java src/test/org/apache/hadoop/dfs/TestDFSStorageStateRecovery.java
Date Mon, 16 Jun 2008 19:53:15 GMT
Author: shv
Date: Mon Jun 16 12:53:15 2008
New Revision: 668278

URL: http://svn.apache.org/viewvc?rev=668278&view=rev
Log:
HADOOP-3363. Merge -r 668263:668264 from trunk to branch 0.18.

Modified:
    hadoop/core/branches/branch-0.18/CHANGES.txt
    hadoop/core/branches/branch-0.18/src/hdfs/org/apache/hadoop/dfs/FSImage.java
    hadoop/core/branches/branch-0.18/src/test/org/apache/hadoop/dfs/TestDFSStorageStateRecovery.java

Modified: hadoop/core/branches/branch-0.18/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.18/CHANGES.txt?rev=668278&r1=668277&r2=668278&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.18/CHANGES.txt (original)
+++ hadoop/core/branches/branch-0.18/CHANGES.txt Mon Jun 16 12:53:15 2008
@@ -585,6 +585,8 @@
     HADOOP-3548. Fixes build.xml to copy all *.jar files to the dist.
     (Owen O'Malley via ddas)
 
+    HADOOP-3363. Fix unformatted storage detection in FSImage. (shv)
+
 Release 0.17.0 - 2008-05-18
 
   INCOMPATIBLE CHANGES

Modified: hadoop/core/branches/branch-0.18/src/hdfs/org/apache/hadoop/dfs/FSImage.java
URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.18/src/hdfs/org/apache/hadoop/dfs/FSImage.java?rev=668278&r1=668277&r2=668278&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.18/src/hdfs/org/apache/hadoop/dfs/FSImage.java (original)
+++ hadoop/core/branches/branch-0.18/src/hdfs/org/apache/hadoop/dfs/FSImage.java Mon Jun 16
12:53:15 2008
@@ -562,9 +562,12 @@
 
   boolean isConversionNeeded(StorageDirectory sd) throws IOException {
     File oldImageDir = new File(sd.root, "image");
-    if (!oldImageDir.exists())
-      throw new InconsistentFSStateException(sd.root,
-          oldImageDir + " does not exist.");
+    if (!oldImageDir.exists()) {
+      if(sd.getVersionFile().exists())
+        throw new InconsistentFSStateException(sd.root,
+            oldImageDir + " does not exist.");
+      return false;
+    }
     // check the layout version inside the image file
     File oldF = new File(oldImageDir, "fsimage");
     RandomAccessFile oldFile = new RandomAccessFile(oldF, "rws");

Modified: hadoop/core/branches/branch-0.18/src/test/org/apache/hadoop/dfs/TestDFSStorageStateRecovery.java
URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.18/src/test/org/apache/hadoop/dfs/TestDFSStorageStateRecovery.java?rev=668278&r1=668277&r2=668278&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.18/src/test/org/apache/hadoop/dfs/TestDFSStorageStateRecovery.java
(original)
+++ hadoop/core/branches/branch-0.18/src/test/org/apache/hadoop/dfs/TestDFSStorageStateRecovery.java
Mon Jun 16 12:53:15 2008
@@ -37,7 +37,7 @@
  
   private static final Log LOG = LogFactory.getLog(
                                                    "org.apache.hadoop.dfs.TestDFSStorageStateRecovery");
-  private Configuration conf;
+  private Configuration conf = null;
   private int testCounter = 0;
   private MiniDFSCluster cluster = null;
   
@@ -197,8 +197,15 @@
           try {
             cluster = new MiniDFSCluster(conf, 0, StartupOption.REGULAR);
             throw new AssertionError("NameNode should have failed to start");
-          } catch (Exception expected) {
-            // expected
+          } catch (IOException expected) {
+            // the exception is expected
+            // check that the message says "not formatted" 
+            // when storage directory is empty (case #5)
+            if(!testCases[i][0] && !testCases[i][2] 
+                      && !testCases[i][1] && !testCases[i][3]) {
+              assertTrue(expected.getLocalizedMessage().contains(
+                  "NameNode is not formatted"));
+            }
           }
         }
         



Mime
View raw message