Supplement to HDFS-9574.
This commit is contained in:
parent
04b8a19f81
commit
b91715bc83
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user