Skip to content

Commit a6b15ff

Browse files
committed
add refetch logic
1 parent ac794c0 commit a6b15ff

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DFSStripedInputStream.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,12 +277,14 @@ boolean createBlockReader(LocatedBlock block, long offsetInBlock,
277277
if (curRetryCounts++ < readDNMaxRetryCounts) {
278278
DFSClient.LOG.info("Try to reconnect to {} for block {} for {} time.", dnInfo.addr,
279279
block.getBlock(), curRetryCounts);
280+
// Re-fetch the block in case the block has been moved.
281+
fetchBlockAt(block.getStartOffset());
280282
continue;
281283
}
282284
//TODO: handles connection issues
283285
DFSClient.LOG.warn("Failed to connect to {} for block {} after retrying {} time.",
284286
dnInfo.addr, block.getBlock(), curRetryCounts, e);
285-
// re-fetch the block in case the block has been moved
287+
// Re-fetch the block in case the block has been moved
286288
fetchBlockAt(block.getStartOffset());
287289
addToLocalDeadNodes(dnInfo.info);
288290
}

0 commit comments

Comments
 (0)