Return-Path: Delivered-To: apmail-hadoop-common-commits-archive@www.apache.org Received: (qmail 92552 invoked from network); 19 Nov 2010 03:56:59 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 19 Nov 2010 03:56:59 -0000 Received: (qmail 98945 invoked by uid 500); 19 Nov 2010 03:57:31 -0000 Delivered-To: apmail-hadoop-common-commits-archive@hadoop.apache.org Received: (qmail 98799 invoked by uid 500); 19 Nov 2010 03:57:30 -0000 Mailing-List: contact common-commits-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: common-dev@hadoop.apache.org Delivered-To: mailing list common-commits@hadoop.apache.org Received: (qmail 98787 invoked by uid 99); 19 Nov 2010 03:57:30 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 19 Nov 2010 03:57:30 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 19 Nov 2010 03:57:29 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id AD9C623888E4; Fri, 19 Nov 2010 03:56:15 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: common-commits@hadoop.apache.org From: eli@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20101119035615.AD9C623888E4@eris.apache.org> 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); } /**