HDFS-8894. Set SO_KEEPALIVE on DN server sockets. Contributed by Kanaka Kumar Avvaru.

(cherry picked from commit 49949a4bb0)
(cherry picked from commit 2796c1099f)
This commit is contained in:
Andrew Wang 2015-12-15 14:38:35 -08:00
parent f22d0046de
commit 8e5de6cc42
3 changed files with 7 additions and 1 deletions

View File

@ -139,6 +139,7 @@ class DataStreamer extends Daemon {
NetUtils.connect(sock, isa, client.getRandomLocalInterfaceAddr(), NetUtils.connect(sock, isa, client.getRandomLocalInterfaceAddr(),
conf.getSocketTimeout()); conf.getSocketTimeout());
sock.setSoTimeout(timeout); sock.setSoTimeout(timeout);
sock.setKeepAlive(true);
if (conf.getSocketSendBufferSize() > 0) { if (conf.getSocketSendBufferSize() > 0) {
sock.setSendBufferSize(conf.getSocketSendBufferSize()); sock.setSendBufferSize(conf.getSocketSendBufferSize());
} }

View File

@ -856,6 +856,9 @@ Release 2.8.0 - UNRELEASED
HDFS-9514. TestDistributedFileSystem.testDFSClientPeerWriteTimeout failing; HDFS-9514. TestDistributedFileSystem.testDFSClientPeerWriteTimeout failing;
exception being swallowed. (Wei-Chiu Chuang via Yongjun Zhang) exception being swallowed. (Wei-Chiu Chuang via Yongjun Zhang)
HDFS-8894. Set SO_KEEPALIVE on DN server sockets.
(Kanaka Kumar Avvaru via wang)
OPTIMIZATIONS OPTIMIZATIONS
HDFS-8026. Trace FSOutputSummer#writeChecksumChunks rather than HDFS-8026. Trace FSOutputSummer#writeChecksumChunks rather than

View File

@ -710,6 +710,7 @@ class DataXceiver extends Receiver implements Runnable {
(HdfsConstants.WRITE_TIMEOUT_EXTENSION * targets.length); (HdfsConstants.WRITE_TIMEOUT_EXTENSION * targets.length);
NetUtils.connect(mirrorSock, mirrorTarget, timeoutValue); NetUtils.connect(mirrorSock, mirrorTarget, timeoutValue);
mirrorSock.setSoTimeout(timeoutValue); mirrorSock.setSoTimeout(timeoutValue);
mirrorSock.setKeepAlive(true);
if (dnConf.getTransferSocketSendBufferSize() > 0) { if (dnConf.getTransferSocketSendBufferSize() > 0) {
mirrorSock.setSendBufferSize( mirrorSock.setSendBufferSize(
dnConf.getTransferSocketSendBufferSize()); dnConf.getTransferSocketSendBufferSize());
@ -1127,7 +1128,8 @@ class DataXceiver extends Receiver implements Runnable {
proxySock = datanode.newSocket(); proxySock = datanode.newSocket();
NetUtils.connect(proxySock, proxyAddr, dnConf.socketTimeout); NetUtils.connect(proxySock, proxyAddr, dnConf.socketTimeout);
proxySock.setSoTimeout(dnConf.socketTimeout); proxySock.setSoTimeout(dnConf.socketTimeout);
proxySock.setKeepAlive(true);
OutputStream unbufProxyOut = NetUtils.getOutputStream(proxySock, OutputStream unbufProxyOut = NetUtils.getOutputStream(proxySock,
dnConf.socketWriteTimeout); dnConf.socketWriteTimeout);
InputStream unbufProxyIn = NetUtils.getInputStream(proxySock); InputStream unbufProxyIn = NetUtils.getInputStream(proxySock);