[ 
https://issues.apache.org/jira/browse/HADOOP-10987?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14109888#comment-14109888
 ] 

Colin Patrick McCabe commented on HADOOP-10987:
-----------------------------------------------

Nice idea.

{code}
+  public RemoteIterator<FileStatus> listStatusIterator(final Path p)
{code}
Can we put a comment in the base class that this implementation designed to be 
overriden by filesystems that have a more efficient implementation?

{code}
+      @Override
+      public RemoteIterator<LocatedFileStatus> next(final FileSystem fs, final 
Path p)
+          throws IOException {
+        if (fs instanceof DistributedFileSystem) {
+          return ((DistributedFileSystem)fs).listLocatedStatus(p, filter);
         }
+        // symlink resolution for this methos does not work cross file systems
+        // because it is a protected method.
+        throw new IOException("Link resolution does not work with multiple " +
+            "file systems for listLocatedStatus(): " + p);
       }
{code}
This is inconsistent with how all the other operations work.  They do handle 
cross-filesystem symlinks.  There are two options for fixing it that I see:
1. Create a public method in FileSystem.java that calls the protected 
two-argument form of listLocatedStatus.
2. Call the public one-argument form of listLocatedStatus and do the filtering 
in DistributedFileSystem#listLocatedStatus.

> Provide an iterator-based listing API for FileSystem
> ----------------------------------------------------
>
>                 Key: HADOOP-10987
>                 URL: https://issues.apache.org/jira/browse/HADOOP-10987
>             Project: Hadoop Common
>          Issue Type: Improvement
>            Reporter: Kihwal Lee
>            Assignee: Kihwal Lee
>         Attachments: HADOOP-10987.patch
>
>
> Iterator based listing methods already exist in {{FileContext}} for both 
> simple listing and listing with locations. However, {{FileSystem}} lacks the 
> former.  From what I understand, it wasn't added to {{FileSystem}} because it 
> was believed to be phased out soon. Since {{FileSystem}} is very well alive 
> today and new features are getting added frequently, I propose adding an 
> iterator based {{listStatus}} method. As for the name of the new method, we 
> can use the same name used in {{FileContext}} : {{listStatusIterator()}}.
> It will be particularly useful when listing giant directories. Without this, 
> the client has to build up a huge data structure and hold it in memory. We've 
> seen client JVMs running out of memory because of this.
> Once this change is made, we can modify FsShell, etc. in followup jiras.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to