HDFS-2209 datanode connection failure logging
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.23@1180354 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
f74e8b2219
commit
9993ecab87
|
@ -388,6 +388,8 @@ public class DFSInputStream extends FSInputStream {
|
||||||
DatanodeInfo chosenNode = null;
|
DatanodeInfo chosenNode = null;
|
||||||
int refetchToken = 1; // only need to get a new access token once
|
int refetchToken = 1; // only need to get a new access token once
|
||||||
|
|
||||||
|
boolean connectFailedOnce = false;
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
//
|
//
|
||||||
// Compute desired block
|
// Compute desired block
|
||||||
|
@ -409,6 +411,10 @@ public class DFSInputStream extends FSInputStream {
|
||||||
accessToken,
|
accessToken,
|
||||||
offsetIntoBlock, blk.getNumBytes() - offsetIntoBlock,
|
offsetIntoBlock, blk.getNumBytes() - offsetIntoBlock,
|
||||||
buffersize, verifyChecksum, dfsClient.clientName);
|
buffersize, verifyChecksum, dfsClient.clientName);
|
||||||
|
if(connectFailedOnce) {
|
||||||
|
DFSClient.LOG.info("Successfully connected to " + targetAddr +
|
||||||
|
" for block " + blk.getBlockId());
|
||||||
|
}
|
||||||
return chosenNode;
|
return chosenNode;
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
if (ex instanceof InvalidBlockTokenException && refetchToken > 0) {
|
if (ex instanceof InvalidBlockTokenException && refetchToken > 0) {
|
||||||
|
@ -428,11 +434,9 @@ public class DFSInputStream extends FSInputStream {
|
||||||
refetchToken--;
|
refetchToken--;
|
||||||
fetchBlockAt(target);
|
fetchBlockAt(target);
|
||||||
} else {
|
} else {
|
||||||
DFSClient.LOG.warn("Failed to connect to " + targetAddr
|
connectFailedOnce = true;
|
||||||
+ ", add to deadNodes and continue " + ex);
|
DFSClient.LOG.warn("Failed to connect to " + targetAddr + " for block"
|
||||||
if (DFSClient.LOG.isDebugEnabled()) {
|
+ ", add to deadNodes and continue. " + ex, ex);
|
||||||
DFSClient.LOG.debug("Connection failure ", ex);
|
|
||||||
}
|
|
||||||
// Put chosen node into dead list, continue
|
// Put chosen node into dead list, continue
|
||||||
addToDeadNodes(chosenNode);
|
addToDeadNodes(chosenNode);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue