Repository: hadoop Updated Branches: refs/heads/branch-2.6 04b8a19f8 -> b91715bc8
Supplement to HDFS-9574. Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/b91715bc Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/b91715bc Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/b91715bc Branch: refs/heads/branch-2.6 Commit: b91715bc837ac0cf7e607c202bce7b3637f56f4c Parents: 04b8a19 Author: Kihwal Lee <kih...@apache.org> Authored: Fri Jan 8 13:10:09 2016 -0600 Committer: Kihwal Lee <kih...@apache.org> Committed: Fri Jan 8 13:10:09 2016 -0600 ---------------------------------------------------------------------- .../src/main/java/org/apache/hadoop/hdfs/DFSInputStream.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/b91715bc/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSInputStream.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSInputStream.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSInputStream.java index 506b485..a9bbb77 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSInputStream.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSInputStream.java @@ -323,6 +323,7 @@ implements ByteBufferReadable, CanSetDropBehind, CanSetReadahead, Arrays.asList(locatedblock.getLocations())); LinkedList<DatanodeInfo> retryList = new LinkedList<DatanodeInfo>(); boolean isRetry = false; + boolean timerStarted = false; long startTime = 0; while (nodeList.size() > 0) { DatanodeInfo datanode = nodeList.pop(); @@ -370,8 +371,9 @@ implements ByteBufferReadable, CanSetDropBehind, CanSetReadahead, if (isRetry) { // start tracking the time - if (startTime == 0) { + if (!timerStarted) { startTime = Time.monotonicNow(); + timerStarted = true; } try { Thread.sleep(500); // delay between retries. @@ -381,7 +383,7 @@ implements ByteBufferReadable, CanSetDropBehind, CanSetReadahead, } // see if we ran out of retry time - if (startTime > 0 && (Time.monotonicNow() - startTime > timeout)) { + if (timerStarted && (Time.monotonicNow() - startTime > timeout)) { break; } }