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

Ohad Raviv commented on HADOOP-14600:
-------------------------------------

Hi,
We also encountered a similar problem as SPARK-21137, when we debugged it we 
saw that all the time got consumed in the initilazation of LocatedFileStatus 
when in FileInputFormat tries to get: 
{code}
RemoteIterator<LocatedFileStatus> iter = 
fs.listLocatedStatus(globStat.getPath());
{code}
However, non of the "special" methods of LocatedFileStatus are used in the 
loop, so changing it to:
{code}
for (FileStatus globStat: matches) {
    if (globStat.isDirectory()) {
        RemoteIterator<FileStatus> iter =
                fs.listStatusIterator(globStat.getPath());
        while (iter.hasNext()) {
            FileStatus stat = iter.next();
            if (inputFilter.accept(stat.getPath())) {
                if (recursive && stat.isDirectory()) {
                    addInputPathRecursively(result, fs, stat.getPath(),
                            inputFilter);
                } else {
                    result.add(stat);
                }
            }
        }
    } else {
        result.add(globStat);
    }
}
{code}
actually solved all the problem.
I know that it is not the only place that needs to change, 
but I would like to know what do you think about that?

thanks,
Ohad.


> LocatedFileStatus constructor forces RawLocalFS to exec a process to get the 
> permissions
> ----------------------------------------------------------------------------------------
>
>                 Key: HADOOP-14600
>                 URL: https://issues.apache.org/jira/browse/HADOOP-14600
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: fs
>    Affects Versions: 2.7.3
>         Environment: file:// in a dir with many files
>            Reporter: Steve Loughran
>            Assignee: Ping Liu
>         Attachments: HADOOP-14600.001.patch, HADOOP-14600.002.patch, 
> HADOOP-14600.003.patch, HADOOP-14600.004.patch, HADOOP-14600.005.patch, 
> HADOOP-14600.006.patch, HADOOP-14600.007.patch, HADOOP-14600.008.patch, 
> HADOOP-14600.009.patch, TestRawLocalFileSystemContract.java
>
>
> Reported in SPARK-21137. a {{FileSystem.listStatus}} call really craws 
> against the local FS, because {{FileStatus.getPemissions}} call forces  
> {{DeprecatedRawLocalFileStatus}} tp spawn a process to read the real UGI 
> values.
> That is: for every other FS, what's a field lookup or even a no-op, on the 
> local FS it's a process exec/spawn, with all the costs. This gets expensive 
> if you have many files.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to