Repository: hadoop Updated Branches: refs/heads/trunk b5d4c7dc7 -> 438efc363
HDFS-10291 TestShortCircuitLocalRead failing (stevel) (cherry picked from commit dd64769699ea4c85abdf9c590b9db680837e8b27) Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/438efc36 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/438efc36 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/438efc36 Branch: refs/heads/trunk Commit: 438efc36349fc817d6c56f433b51ac7a45ab6759 Parents: b5d4c7d Author: Steve Loughran <ste...@apache.org> Authored: Mon Apr 18 10:26:35 2016 +0100 Committer: Walter Su <waltersu4...@apache.org> Committed: Tue Apr 19 17:48:20 2016 +0800 ---------------------------------------------------------------------- .../hadoop/hdfs/shortcircuit/TestShortCircuitLocalRead.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/438efc36/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/shortcircuit/TestShortCircuitLocalRead.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/shortcircuit/TestShortCircuitLocalRead.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/shortcircuit/TestShortCircuitLocalRead.java index f4fbebc..116dc88 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/shortcircuit/TestShortCircuitLocalRead.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/shortcircuit/TestShortCircuitLocalRead.java @@ -153,8 +153,11 @@ public class TestShortCircuitLocalRead { //Read a small number of bytes first. int nread = stm.read(actual, 0, 3); nread += stm.read(actual, nread, 2); - //Read across chunk boundary - nread += stm.read(actual, nread, 517); + int len = 517; + if (actual.length - nread >= len) { + //Read across chunk boundary + nread += stm.read(actual, nread, len); + } checkData(actual, readOffset, expected, nread, "A few bytes"); //Now read rest of it while (nread < actual.length) {