HDFS-9100. HDFS Balancer does not respect dfs.client.use.datanode.hostname. Contributed by Casey Brotherton.

This commit is contained in:
Yongjun Zhang 2015-10-02 11:56:55 -07:00
parent a68b6eb0f4
commit 1037ee580f
2 changed files with 12 additions and 2 deletions

View File

@ -1481,6 +1481,9 @@ Release 2.8.0 - UNRELEASED
HDFS-9001. DFSUtil.getNsServiceRpcUris() can return too many entries in a
non-HA, non-federated cluster. (Daniel Templeton via atm)
HDFS-9100. HDFS Balancer does not respect dfs.client.use.datanode.hostname.
(Casey Brotherton via Yongjun Zhang)
Release 2.7.2 - UNRELEASED
INCOMPATIBLE CHANGES

View File

@ -50,6 +50,7 @@
import org.apache.hadoop.hdfs.DFSUtil;
import org.apache.hadoop.hdfs.DFSUtilClient;
import org.apache.hadoop.hdfs.DistributedFileSystem;
import org.apache.hadoop.hdfs.client.HdfsClientConfigKeys;
import org.apache.hadoop.hdfs.protocol.Block;
import org.apache.hadoop.hdfs.protocol.DatanodeInfo;
import org.apache.hadoop.hdfs.protocol.ExtendedBlock;
@ -122,6 +123,8 @@ public class Dispatcher {
private final int ioFileBufferSize;
private final boolean connectToDnViaHostname;
static class Allocator {
private final int max;
private int count = 0;
@ -322,8 +325,9 @@ private void dispatch() {
DataInputStream in = null;
try {
sock.connect(
NetUtils.createSocketAddr(target.getDatanodeInfo().getXferAddr()),
HdfsConstants.READ_TIMEOUT);
NetUtils.createSocketAddr(target.getDatanodeInfo().
getXferAddr(Dispatcher.this.connectToDnViaHostname)),
HdfsConstants.READ_TIMEOUT);
sock.setKeepAlive(true);
@ -942,6 +946,9 @@ public Dispatcher(NameNodeConnector nnc, Set<String> includedNodes,
DataTransferSaslUtil.getSaslPropertiesResolver(conf),
TrustedChannelResolver.getInstance(conf), nnc.fallbackToSimpleAuth);
this.ioFileBufferSize = DFSUtilClient.getIoFileBufferSize(conf);
this.connectToDnViaHostname = conf.getBoolean(
HdfsClientConfigKeys.DFS_CLIENT_USE_DN_HOSTNAME,
HdfsClientConfigKeys.DFS_CLIENT_USE_DN_HOSTNAME_DEFAULT);
}
public DistributedFileSystem getDistributedFileSystem() {