xinglin commented on code in PR #6446:
URL: https://github.com/apache/hadoop/pull/6446#discussion_r1451226414


##########
hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DFSInputStream.java:
##########
@@ -796,11 +797,18 @@ private synchronized int readBuffer(ReaderStrategy 
reader, int len,
         // we want to remember which block replicas we have tried
         corruptedBlocks.addCorruptedBlock(getCurrentBlock(), currentNode);
       } catch (IOException e) {
-        if (!retryCurrentNode) {
-          DFSClient.LOG.warn("Exception while reading from "
-              + getCurrentBlock() + " of " + src + " from "
-              + currentNode, e);
+        String msg = String.format("Failed to read block %s for file %s from 
datanode %s. "
+                + "Exception is %s. Retry with the current or next available 
datanode.",
+            getCurrentBlock().getBlockName(), src, currentNode.getXferAddr(), 
e);

Review Comment:
   > Consider using currentNode.getResolvedAddress?
   
   We chose to use getXferAddr(), to be consistent with what is stored in the 
DNAddrPair object returned by getBestNodeDNAddrPair(). 
   
   > When retry with current v.s. next DN? Is any way to differenciate add to 
logs?
   
   readBuffer() simply retries to read from the current (first) DN one more 
time, before moving on the next DN. So, the order readBuffer() will follow is 
DN1 -> DN1 -> DN2 -> DN3 -> refresh() -> DN1 -> DN2 -> DN3 -> refresh() and 
repeat from DN1 to DN3, until we hit refresh limit.
   
   We print datanode tranferAddr in the log. So, we can tell whether it is 
retry on the current node or a different node. I guess there is not much value 
to print different log lines when we retry on the current node and when we 
retry a different node.  



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to