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

(cherry picked from commit 49949a4bb0)
This commit is contained in:
Andrew Wang 2015-12-15 14:38:35 -08:00
parent e0abb0a4e7
commit 2796c1099f
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(),
conf.getSocketTimeout());
sock.setSoTimeout(timeout);
sock.setKeepAlive(true);
if (conf.getSocketSendBufferSize() > 0) {
sock.setSendBufferSize(conf.getSocketSendBufferSize());
}

View File

@ -895,6 +895,9 @@ Release 2.8.0 - UNRELEASED
HDFS-9535. Newly completed blocks in IBR should not be considered
under-replicated too quickly. (Mingliang Liu via jing9)
HDFS-8894. Set SO_KEEPALIVE on DN server sockets.
(Kanaka Kumar Avvaru via wang)
OPTIMIZATIONS
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);
NetUtils.connect(mirrorSock, mirrorTarget, timeoutValue);
mirrorSock.setSoTimeout(timeoutValue);
mirrorSock.setKeepAlive(true);
if (dnConf.getTransferSocketSendBufferSize() > 0) {
mirrorSock.setSendBufferSize(
dnConf.getTransferSocketSendBufferSize());
@ -1127,6 +1128,7 @@ class DataXceiver extends Receiver implements Runnable {
proxySock = datanode.newSocket();
NetUtils.connect(proxySock, proxyAddr, dnConf.socketTimeout);
proxySock.setSoTimeout(dnConf.socketTimeout);
proxySock.setKeepAlive(true);
OutputStream unbufProxyOut = NetUtils.getOutputStream(proxySock,
dnConf.socketWriteTimeout);