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:
Todd Lipcon 2012-07-16 22:41:56 +00:00
parent 2799d9659d
commit 30099efb35
3 changed files with 5 additions and 1 deletions

View File

@ -829,6 +829,9 @@ Release 0.23.3 - UNRELEASED
HADOOP-8573. Configuration tries to read from an inputstream resource
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
INCOMPATIBLE CHANGES

View File

@ -572,7 +572,7 @@ public abstract class FileSystem extends Configured implements Closeable {
throw new IllegalArgumentException("Invalid start or len parameter");
}
if (file.getLen() < start) {
if (file.getLen() <= start) {
return new BlockLocation[0];
}

View File

@ -122,6 +122,7 @@ public class TestGetFileBlockLocations extends TestCase {
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() * 3, status);
oneTest((int) status.getLen(), (int) status.getLen() * 2, status);
for (int i = 0; i < 10; ++i) {
oneTest((int) status.getLen() * i / 10, (int) status.getLen() * (i + 1)
/ 10, status);