HADOOP-12810. FileSystem#listLocatedStatus causes unnecessary RPC calls (Contributed by Ryan Blue)
This commit is contained in:
parent
77ba5add0d
commit
96ea309431
@ -1720,6 +1720,9 @@ Release 2.7.3 - UNRELEASED
|
|||||||
|
|
||||||
OPTIMIZATIONS
|
OPTIMIZATIONS
|
||||||
|
|
||||||
|
HADOOP-12810. FileSystem#listLocatedStatus causes unnecessary RPC calls
|
||||||
|
(Ryan Blue via vinayakumarb)
|
||||||
|
|
||||||
BUG FIXES
|
BUG FIXES
|
||||||
|
|
||||||
HADOOP-12296. when setnetgrent returns 0 in linux, exception should be
|
HADOOP-12296. when setnetgrent returns 0 in linux, exception should be
|
||||||
|
@ -1749,8 +1749,10 @@ public LocatedFileStatus next() throws IOException {
|
|||||||
throw new NoSuchElementException("No more entries in " + f);
|
throw new NoSuchElementException("No more entries in " + f);
|
||||||
}
|
}
|
||||||
FileStatus result = stats[i++];
|
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() ?
|
BlockLocation[] locs = result.isFile() ?
|
||||||
getFileBlockLocations(result.getPath(), 0, result.getLen()) :
|
getFileBlockLocations(result, 0, result.getLen()) :
|
||||||
null;
|
null;
|
||||||
return new LocatedFileStatus(result, locs);
|
return new LocatedFileStatus(result, locs);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user