Supplement to HDFS-9574.

This commit is contained in:
Kihwal Lee 2016-01-08 13:10:09 -06:00
parent 04b8a19f81
commit b91715bc83

View File

@ -323,6 +323,7 @@ private long readBlockLength(LocatedBlock locatedblock) throws IOException {
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 @@ private long readBlockLength(LocatedBlock locatedblock) throws IOException {
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 @@ private long readBlockLength(LocatedBlock locatedblock) throws IOException {
}
// see if we ran out of retry time
if (startTime > 0 && (Time.monotonicNow() - startTime > timeout)) {
if (timerStarted && (Time.monotonicNow() - startTime > timeout)) {
break;
}
}