Skip to content

Commit

Permalink
HDFS-8894. Set SO_KEEPALIVE on DN server sockets. Contributed by Kana…
Browse files Browse the repository at this point in the history
…ka Kumar Avvaru.
  • Loading branch information
umbrant committed Dec 15, 2015
1 parent 8602692 commit 49949a4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ static Socket createSocketForPipeline(final DatanodeInfo first,
NetUtils.connect(sock, isa, client.getRandomLocalInterfaceAddr(),
conf.getSocketTimeout());
sock.setSoTimeout(timeout);
sock.setKeepAlive(true);
if (conf.getSocketSendBufferSize() > 0) {
sock.setSendBufferSize(conf.getSocketSendBufferSize());
}
Expand Down
3 changes: 3 additions & 0 deletions hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1761,6 +1761,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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,7 @@ public void writeBlock(final ExtendedBlock block,
(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());
Expand Down Expand Up @@ -1127,7 +1128,8 @@ public void replaceBlock(final ExtendedBlock block,
proxySock = datanode.newSocket();
NetUtils.connect(proxySock, proxyAddr, dnConf.socketTimeout);
proxySock.setSoTimeout(dnConf.socketTimeout);

proxySock.setKeepAlive(true);

OutputStream unbufProxyOut = NetUtils.getOutputStream(proxySock,
dnConf.socketWriteTimeout);
InputStream unbufProxyIn = NetUtils.getInputStream(proxySock);
Expand Down

0 comments on commit 49949a4

Please sign in to comment.