hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dhr...@apache.org
Subject svn commit: r582358 - in /lucene/hadoop/branches/branch-0.14: CHANGES.txt src/java/org/apache/hadoop/dfs/FSEditLog.java src/java/org/apache/hadoop/dfs/FSImage.java src/test/org/apache/hadoop/dfs/TestCheckpoint.java
Date Fri, 05 Oct 2007 17:40:12 GMT
Author: dhruba
Date: Fri Oct  5 10:40:10 2007
New Revision: 582358

URL: http://svn.apache.org/viewvc?rev=582358&view=rev
Log:
HADOOP-1997.  TestCheckpoint closes the edits file after writing to it,
otherwise the rename of this file on Windows fails.
(Konstantin Shvachko via dhruba)
svn merge -c 582356 from trunk.


Modified:
    lucene/hadoop/branches/branch-0.14/CHANGES.txt
    lucene/hadoop/branches/branch-0.14/src/java/org/apache/hadoop/dfs/FSEditLog.java
    lucene/hadoop/branches/branch-0.14/src/java/org/apache/hadoop/dfs/FSImage.java
    lucene/hadoop/branches/branch-0.14/src/test/org/apache/hadoop/dfs/TestCheckpoint.java

Modified: lucene/hadoop/branches/branch-0.14/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/hadoop/branches/branch-0.14/CHANGES.txt?rev=582358&r1=582357&r2=582358&view=diff
==============================================================================
--- lucene/hadoop/branches/branch-0.14/CHANGES.txt (original)
+++ lucene/hadoop/branches/branch-0.14/CHANGES.txt Fri Oct  5 10:40:10 2007
@@ -34,6 +34,10 @@
     HADOOP-1961.  The -get option to dfs-shell works when a single filename
     is specified.  (Raghu Angadi via dhruba)
 
+    HADOOP-1997.  TestCheckpoint closes the edits file after writing to it,
+    otherwise the rename of this file on Windows fails.
+    (Konstantin Shvachko via dhruba)
+
 Release 0.14.1 - 2007-09-04
 
   BUG FIXES

Modified: lucene/hadoop/branches/branch-0.14/src/java/org/apache/hadoop/dfs/FSEditLog.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/branches/branch-0.14/src/java/org/apache/hadoop/dfs/FSEditLog.java?rev=582358&r1=582357&r2=582358&view=diff
==============================================================================
--- lucene/hadoop/branches/branch-0.14/src/java/org/apache/hadoop/dfs/FSEditLog.java (original)
+++ lucene/hadoop/branches/branch-0.14/src/java/org/apache/hadoop/dfs/FSEditLog.java Fri Oct
 5 10:40:10 2007
@@ -159,7 +159,7 @@
    * server to exit
    */
   synchronized void processIOError(int index) throws IOException {
-    if (editStreams == null || editStreams.size() == 1) {
+    if (editStreams == null || editStreams.size() <= 1) {
       throw new IOException("Checkpoint directories inaccessible.");
     }
     assert(index < getNumStorageDirs());
@@ -619,7 +619,7 @@
         //
         getEditFile(idx).delete();
         if (!getEditNewFile(idx).renameTo(getEditFile(idx))) {
-          processIOError(idx); 
+          fsimage.processIOError(idx); 
           idx--; 
         }
       }

Modified: lucene/hadoop/branches/branch-0.14/src/java/org/apache/hadoop/dfs/FSImage.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/branches/branch-0.14/src/java/org/apache/hadoop/dfs/FSImage.java?rev=582358&r1=582357&r2=582358&view=diff
==============================================================================
--- lucene/hadoop/branches/branch-0.14/src/java/org/apache/hadoop/dfs/FSImage.java (original)
+++ lucene/hadoop/branches/branch-0.14/src/java/org/apache/hadoop/dfs/FSImage.java Fri Oct
 5 10:40:10 2007
@@ -446,7 +446,7 @@
   void processIOError(int index) throws IOException {
     int nrDirs = getNumStorageDirs();
     assert(index >= 0 && index < nrDirs);
-    if (nrDirs == 1)
+    if (nrDirs <= 1)
       throw new IOException("Checkpoint directories inaccessible.");
     storageDirs.remove(index);
   }

Modified: lucene/hadoop/branches/branch-0.14/src/test/org/apache/hadoop/dfs/TestCheckpoint.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/branches/branch-0.14/src/test/org/apache/hadoop/dfs/TestCheckpoint.java?rev=582358&r1=582357&r2=582358&view=diff
==============================================================================
--- lucene/hadoop/branches/branch-0.14/src/test/org/apache/hadoop/dfs/TestCheckpoint.java
(original)
+++ lucene/hadoop/branches/branch-0.14/src/test/org/apache/hadoop/dfs/TestCheckpoint.java
Fri Oct  5 10:40:10 2007
@@ -173,8 +173,16 @@
       assertFalse(image.getEditNewFile(idx).exists());
       File edits = image.getEditFile(idx);
       assertTrue(edits.exists()); // edits should exist and be empty
-      assertTrue(
-        (new RandomAccessFile(edits, "r")).length() == Integer.SIZE/Byte.SIZE);
+      long editsLen = -1;
+      RandomAccessFile eF = null;
+      try {
+        eF = new RandomAccessFile(edits, "r");
+        editsLen = eF.length();
+      } finally {
+        if(eF != null)
+          eF.close();
+      }
+      assertTrue(editsLen == Integer.SIZE/Byte.SIZE);
     }
     
     fileSys = cluster.getFileSystem();



Mime
View raw message