hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject svn commit: r1036729 - in /hadoop/common/trunk: CHANGES.txt src/java/org/apache/hadoop/fs/RawLocalFileSystem.java
Date Fri, 19 Nov 2010 03:56:15 GMT
Author: eli
Date: Fri Nov 19 03:56:15 2010
New Revision: 1036729

URL: http://svn.apache.org/viewvc?rev=1036729&view=rev
Log:
HADOOP-7015. RawLocalFileSystem#listStatus does not deal with a directory whose entries are
changing (e.g. in a multi-thread or multi-process environment). Contributed by Sanjay Radia


Modified:
    hadoop/common/trunk/CHANGES.txt
    hadoop/common/trunk/src/java/org/apache/hadoop/fs/RawLocalFileSystem.java

Modified: hadoop/common/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/CHANGES.txt?rev=1036729&r1=1036728&r2=1036729&view=diff
==============================================================================
--- hadoop/common/trunk/CHANGES.txt (original)
+++ hadoop/common/trunk/CHANGES.txt Fri Nov 19 03:56:15 2010
@@ -15,6 +15,10 @@ Trunk (unreleased changes)
 
   BUG FIXES
 
+    HADOOP-7015. RawLocalFileSystem#listStatus does not deal with a directory
+    whose entries are changing (e.g. in a multi-thread or multi-process
+    environment). (Sanjay Radia via eli)
+
 Release 0.22.0 - Unreleased
 
   INCOMPATIBLE CHANGES

Modified: hadoop/common/trunk/src/java/org/apache/hadoop/fs/RawLocalFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/src/java/org/apache/hadoop/fs/RawLocalFileSystem.java?rev=1036729&r1=1036728&r2=1036729&view=diff
==============================================================================
--- hadoop/common/trunk/src/java/org/apache/hadoop/fs/RawLocalFileSystem.java (original)
+++ hadoop/common/trunk/src/java/org/apache/hadoop/fs/RawLocalFileSystem.java Fri Nov 19 03:56:15
2010
@@ -28,6 +28,7 @@ import java.io.IOException;
 import java.io.OutputStream;
 import java.net.URI;
 import java.nio.ByteBuffer;
+import java.util.Arrays;
 import java.util.EnumSet;
 import java.util.StringTokenizer;
 
@@ -319,10 +320,20 @@ public class RawLocalFileSystem extends 
       return null;
     }
     results = new FileStatus[names.length];
+    int j = 0;
     for (int i = 0; i < names.length; i++) {
-      results[i] = getFileStatus(new Path(f, names[i]));
+      try {
+        results[j] = getFileStatus(new Path(f, names[i]));
+        j++;
+      } catch (FileNotFoundException e) {
+        // ignore the files not found since the dir list may have have changed
+        // since the names[] list was generated.
+      }
+    }
+    if (j == names.length) {
+      return results;
     }
-    return results;
+    return Arrays.copyOf(results, j);
   }
 
   /**



Mime
View raw message