Hello,

I find when we transfer data (DataTransfer), we set the socket read timeout
to *targets.length * socketTimeout*, but not socketTimeout +
READ_TIMEOUT_EXTENSION
* (targets.length-1) as we do in the setting of the pipeline.

What's the purpose of this setting?


public void doRun() throws IOException {
  xmitsInProgress.getAndIncrement();
  Socket sock = null;
  DataOutputStream out = null;
  DataInputStream in = null;
  BlockSender blockSender = null;
  final boolean isClient = clientname.length() > 0;

  try {
    final String dnAddr = targets[0].getXferAddr(connectToDnViaHostname);
    InetSocketAddress curTarget = NetUtils.createSocketAddr(dnAddr);
    if (LOG.isDebugEnabled()) {
      LOG.debug("Connecting to datanode " + dnAddr);
    }
    sock = newSocket();
    NetUtils.connect(sock, curTarget, dnConf.socketTimeout);
*    sock.setSoTimeout(targets.length * dnConf.socketTimeout);<<<<-----*

long writeTimeout = dnConf.socketWriteTimeout +
                    HdfsServerConstants.WRITE_TIMEOUT_EXTENSION *
(targets.length-1);

-- 
Xie Gang

Reply via email to