hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cdoug...@apache.org
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 GMT
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));



Mime
View raw message