HADOOP-8599. Non empty response from FileSystem.getFileBlockLocations when asking for data beyond the end of file. Contributed by Andrey Klochkov.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1362295 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2799d9659d
commit
30099efb35
@ -829,6 +829,9 @@ Release 0.23.3 - UNRELEASED
|
|||||||
HADOOP-8573. Configuration tries to read from an inputstream resource
|
HADOOP-8573. Configuration tries to read from an inputstream resource
|
||||||
multiple times (Robert Evans via tgraves)
|
multiple times (Robert Evans via tgraves)
|
||||||
|
|
||||||
|
HADOOP-8599. Non empty response from FileSystem.getFileBlockLocations when
|
||||||
|
asking for data beyond the end of file. (Andrey Klochkov via todd)
|
||||||
|
|
||||||
Release 0.23.2 - UNRELEASED
|
Release 0.23.2 - UNRELEASED
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
@ -572,7 +572,7 @@ public BlockLocation[] getFileBlockLocations(FileStatus file,
|
|||||||
throw new IllegalArgumentException("Invalid start or len parameter");
|
throw new IllegalArgumentException("Invalid start or len parameter");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file.getLen() < start) {
|
if (file.getLen() <= start) {
|
||||||
return new BlockLocation[0];
|
return new BlockLocation[0];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -122,6 +122,7 @@ public void testGetFileBlockLocations1() throws IOException {
|
|||||||
oneTest(0, (int) status.getLen() * 2, status);
|
oneTest(0, (int) status.getLen() * 2, status);
|
||||||
oneTest((int) status.getLen() * 2, (int) status.getLen() * 4, status);
|
oneTest((int) status.getLen() * 2, (int) status.getLen() * 4, status);
|
||||||
oneTest((int) status.getLen() / 2, (int) status.getLen() * 3, status);
|
oneTest((int) status.getLen() / 2, (int) status.getLen() * 3, status);
|
||||||
|
oneTest((int) status.getLen(), (int) status.getLen() * 2, status);
|
||||||
for (int i = 0; i < 10; ++i) {
|
for (int i = 0; i < 10; ++i) {
|
||||||
oneTest((int) status.getLen() * i / 10, (int) status.getLen() * (i + 1)
|
oneTest((int) status.getLen() * i / 10, (int) status.getLen() * (i + 1)
|
||||||
/ 10, status);
|
/ 10, status);
|
||||||
|
Loading…
Reference in New Issue
Block a user