即使发生IOException,作业也会成功完成

时间:2015-12-12 23:12:09

标签: java hadoop hdfs yarn ioexception

在运行GridMix时,我在主节点上收到各种IOException,我想知道这是否应该是我真正关心的事情,或者是因为我的工作成功完成,这是暂时的:

IOException: Bad connect ack with firstBadLink: \
java.io.IOException: Bad response ERROR for block BP-49483579-10.0.1.190-1449960324681:blk_1073746606_5783 from datanode 10.0.1.192:50010
    at org.apache.hadoop.hdfs.DFSOutputStream$DataStreamer$ResponseProcessor.run(DFSOutputStream.java:819)

2 个答案:

答案 0 :(得分:2)

我无法确定,直到我理解您的完整设置,但很可能是在附加到管道设置时发生了这些异常,就代码而言,您可以说stage == BlockConstructionStage.PIPELINE_SETUP_APPEND

在任何情况下,由于您的工作成功完成,您不必担心,为什么它成功完成因为在尝试将DataOutputStream打开到DataNode管道时会发生一些异常它一直在尝试,直到设置管道。

org.apache.hadoop.hdfs.DFSOutputStream发生异常,以下是您理解的重要代码段。

 private boolean createBlockOutputStream(DatanodeInfo[] nodes, long newGS, boolean recoveryFlag) {
    //Code..
    if (pipelineStatus != SUCCESS) {
      if (pipelineStatus == Status.ERROR_ACCESS_TOKEN) {
        throw new InvalidBlockTokenException(
            "Got access token error for connect ack with firstBadLink as "
                + firstBadLink);
      } else {
        throw new IOException("Bad connect ack with firstBadLink as "
            + firstBadLink);
      }
    }
    //Code..
}

现在,createBlockOutputStreamsetupPipelineForAppendOrRecovery调用,并且正如此方法的代码注释所提到的那样 - "它一直在尝试,直到设置了管道"。

/**
 * Open a DataOutputStream to a DataNode pipeline so that 
 * it can be written to.
 * This happens when a file is appended or data streaming fails
 * It keeps on trying until a pipeline is setup
 */
private boolean setupPipelineForAppendOrRecovery() throws IOException {
    //Code..
    while (!success && !streamerClosed && dfsClient.clientRunning) {
        //Code..
        success = createBlockOutputStream(nodes, newGS, isRecovery);
    }
    //Code..
}

如果您将查看完整的org.apache.hadoop.hdfs.DFSOutputStream代码,您将了解管道设置试用将继续进行,直到创建管道以供追加或新用途。

如果您想要处理它,那么您可以尝试从dfs.datanode.max.xcievers调整hdfs-site.xml属性,最大的人已经报告了相同的解决方案。请注意,您需要在设置属性后重新启动hadoop服务。

<property>
        <name>dfs.datanode.max.xcievers</name>
        <value>8192</value>
</property>

答案 1 :(得分:0)

忽略它?

try {
  ...
} catch (IOException iox) {
  //***NOP***
}