HADOOP-12810. FileSystem#listLocatedStatus causes unnecessary RPC calls (Contributed by Ryan Blue)

(cherry picked from commit 96ea309431)
(cherry picked from commit 2bf5a005fa)
This commit is contained in:
Vinayakumar B 2016-02-17 10:13:41 +05:30
parent c7be3deff7
commit e88c01fa58
2 changed files with 6 additions and 1 deletions

View File

@ -1019,6 +1019,9 @@ Release 2.7.3 - UNRELEASED
OPTIMIZATIONS
HADOOP-12810. FileSystem#listLocatedStatus causes unnecessary RPC calls
(Ryan Blue via vinayakumarb)
BUG FIXES
HADOOP-12296. when setnetgrent returns 0 in linux, exception should be

View File

@ -1732,8 +1732,10 @@ public abstract class FileSystem extends Configured implements Closeable {
throw new NoSuchElementException("No more entry in " + f);
}
FileStatus result = stats[i++];
// for files, use getBlockLocations(FileStatus, int, int) to avoid
// calling getFileStatus(Path) to load the FileStatus again
BlockLocation[] locs = result.isFile() ?
getFileBlockLocations(result.getPath(), 0, result.getLen()) :
getFileBlockLocations(result, 0, result.getLen()) :
null;
return new LocatedFileStatus(result, locs);
}