Return-Path: Delivered-To: apmail-hadoop-core-commits-archive@www.apache.org Received: (qmail 33892 invoked from network); 11 Jul 2008 20:22:26 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 11 Jul 2008 20:22:26 -0000 Received: (qmail 47407 invoked by uid 500); 11 Jul 2008 20:22:27 -0000 Delivered-To: apmail-hadoop-core-commits-archive@hadoop.apache.org Received: (qmail 47379 invoked by uid 500); 11 Jul 2008 20:22:27 -0000 Mailing-List: contact core-commits-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: core-dev@hadoop.apache.org Delivered-To: mailing list core-commits@hadoop.apache.org Received: (qmail 47370 invoked by uid 99); 11 Jul 2008 20:22:27 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Jul 2008 13:22:27 -0700 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, 11 Jul 2008 20:21:43 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id D64C62388A6A; Fri, 11 Jul 2008 13:22:05 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r676070 - in /hadoop/core/branches/branch-0.18: CHANGES.txt src/core/org/apache/hadoop/fs/kfs/KosmosFileSystem.java src/test/org/apache/hadoop/fs/kfs/KFSEmulationImpl.java src/test/org/apache/hadoop/fs/kfs/TestKosmosFileSystem.java Date: Fri, 11 Jul 2008 20:22:05 -0000 To: core-commits@hadoop.apache.org From: cdouglas@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080711202205.D64C62388A6A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: cdouglas Date: Fri Jul 11 13:22:05 2008 New Revision: 676070 URL: http://svn.apache.org/viewvc?rev=676070&view=rev Log: HADOOP-3716. Prevent listStatus in KosmosFileSystem from returning null for valid, empty directories. Contributed by Sriram Rao. Modified: hadoop/core/branches/branch-0.18/CHANGES.txt hadoop/core/branches/branch-0.18/src/core/org/apache/hadoop/fs/kfs/KosmosFileSystem.java hadoop/core/branches/branch-0.18/src/test/org/apache/hadoop/fs/kfs/KFSEmulationImpl.java hadoop/core/branches/branch-0.18/src/test/org/apache/hadoop/fs/kfs/TestKosmosFileSystem.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=676070&r1=676069&r2=676070&view=diff ============================================================================== --- hadoop/core/branches/branch-0.18/CHANGES.txt (original) +++ hadoop/core/branches/branch-0.18/CHANGES.txt Fri Jul 11 13:22:05 2008 @@ -747,6 +747,9 @@ HADOOP-3647. Add debug logs to help track down a very occassional, hard-to-reproduce, bug in shuffle/merge on the reducer. (acmurthy) + HADOOP-3716. Prevent listStatus in KosmosFileSystem from returning + null for valid, empty directories. (Sriram Rao via cdouglas) + Release 0.17.2 - Unreleased BUG FIXES Modified: hadoop/core/branches/branch-0.18/src/core/org/apache/hadoop/fs/kfs/KosmosFileSystem.java URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.18/src/core/org/apache/hadoop/fs/kfs/KosmosFileSystem.java?rev=676070&r1=676069&r2=676070&view=diff ============================================================================== --- hadoop/core/branches/branch-0.18/src/core/org/apache/hadoop/fs/kfs/KosmosFileSystem.java (original) +++ hadoop/core/branches/branch-0.18/src/core/org/apache/hadoop/fs/kfs/KosmosFileSystem.java Fri Jul 11 13:22:05 2008 @@ -147,11 +147,6 @@ continue; numEntries++; } - if (numEntries == 0) { - return null; - } - - // System.out.println("Calling listStatus on: " + path); FileStatus[] pathEntries = new FileStatus[numEntries]; int j = 0; Modified: hadoop/core/branches/branch-0.18/src/test/org/apache/hadoop/fs/kfs/KFSEmulationImpl.java URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.18/src/test/org/apache/hadoop/fs/kfs/KFSEmulationImpl.java?rev=676070&r1=676069&r2=676070&view=diff ============================================================================== --- hadoop/core/branches/branch-0.18/src/test/org/apache/hadoop/fs/kfs/KFSEmulationImpl.java (original) +++ hadoop/core/branches/branch-0.18/src/test/org/apache/hadoop/fs/kfs/KFSEmulationImpl.java Fri Jul 11 13:22:05 2008 @@ -51,34 +51,17 @@ return localFS.isFile(new Path(path)); } - // as part of the emulation, KFS adds ./.. as directory entries - // when doing a directory listing. public String[] readdir(String path) throws IOException { FileStatus[] p = localFS.listStatus(new Path(path)); String[] entries = null; if (p == null) { - if (isDirectory(path)) { - // empty dirs have "." and ".." - entries = new String[2]; - entries[0] = new String("."); - entries[1] = new String(".."); - } - return entries; + return null; } - if (isDirectory(path)) { - // for dirs, add "."/".." as KFS does that - entries = new String[p.length + 2]; - entries[0] = new String("."); - entries[1] = new String(".."); - for (int i = 0; i < p.length; i++) - entries[i+2] = p[i].getPath().toString(); - } else { - entries = new String[p.length]; - for (int i = 0; i < p.length; i++) - entries[i] = p[i].getPath().toString(); - } + entries = new String[p.length]; + for (int i = 0; i < p.length; i++) + entries[i] = p[i].getPath().toString(); return entries; } Modified: hadoop/core/branches/branch-0.18/src/test/org/apache/hadoop/fs/kfs/TestKosmosFileSystem.java URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.18/src/test/org/apache/hadoop/fs/kfs/TestKosmosFileSystem.java?rev=676070&r1=676069&r2=676070&view=diff ============================================================================== --- hadoop/core/branches/branch-0.18/src/test/org/apache/hadoop/fs/kfs/TestKosmosFileSystem.java (original) +++ hadoop/core/branches/branch-0.18/src/test/org/apache/hadoop/fs/kfs/TestKosmosFileSystem.java Fri Jul 11 13:22:05 2008 @@ -107,7 +107,7 @@ kosmosFileSystem.delete(file2, true); p = kosmosFileSystem.listStatus(subDir1); - assertEquals(p, null); + assertEquals(p.length, 0); kosmosFileSystem.delete(baseDir, true); assertFalse(kosmosFileSystem.exists(baseDir));