HDFS-4946. Allow preferLocalNode in BlockPlacementPolicyDefault to be configurable. Contributed by James Kinley and Nathan Roberts.

(cherry picked from commit ba6d5ed955)

Conflicts:
	hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSConfigKeys.java
	hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockPlacementPolicyDefault.java
This commit is contained in:
Kihwal Lee 2016-02-18 14:10:43 -06:00
parent 6475d468f5
commit 019770c769
4 changed files with 25 additions and 2 deletions

View File

@ -30,6 +30,9 @@ Release 2.7.3 - UNRELEASED
HDFS-9669. TcpPeerServer should respect ipc.server.listen.queue.size
(Elliot Clark via cmccabe)
HDFS-4946. Allow preferLocalNode in BlockPlacementPolicyDefault to be
configurable (James Kinley and Nathan Roberts via kihwal)
OPTIMIZATIONS
HDFS-8845. DiskChecker should not traverse the entire tree (Chang Li via

View File

@ -621,7 +621,10 @@ public class DFSConfigKeys extends CommonConfigurationKeys {
public static final String DFS_WEB_AUTHENTICATION_KERBEROS_KEYTAB_KEY = "dfs.web.authentication.kerberos.keytab";
public static final String DFS_NAMENODE_MAX_OP_SIZE_KEY = "dfs.namenode.max.op.size";
public static final int DFS_NAMENODE_MAX_OP_SIZE_DEFAULT = 50 * 1024 * 1024;
public static final String DFS_NAMENODE_BLOCKPLACEMENTPOLICY_DEFAULT_PREFER_LOCAL_NODE_KEY =
"dfs.namenode.block-placement-policy.default.prefer-local-node";
public static final boolean DFS_NAMENODE_BLOCKPLACEMENTPOLICY_DEFAULT_PREFER_LOCAL_NODE_DEFAULT = true;
public static final String DFS_BLOCK_LOCAL_PATH_ACCESS_USER_KEY = "dfs.block.local-path-access.user";
public static final String DFS_DOMAIN_SOCKET_PATH_KEY = "dfs.domain.socket.path";
public static final String DFS_DOMAIN_SOCKET_PATH_DEFAULT = "";

View File

@ -61,7 +61,7 @@ public class BlockPlacementPolicyDefault extends BlockPlacementPolicy {
};
protected boolean considerLoad;
private boolean preferLocalNode = true;
private boolean preferLocalNode;
protected NetworkTopology clusterMap;
protected Host2NodesMap host2datanodeMap;
private FSClusterStats stats;
@ -94,6 +94,11 @@ public class BlockPlacementPolicyDefault extends BlockPlacementPolicy {
this.staleInterval = conf.getLong(
DFSConfigKeys.DFS_NAMENODE_STALE_DATANODE_INTERVAL_KEY,
DFSConfigKeys.DFS_NAMENODE_STALE_DATANODE_INTERVAL_DEFAULT);
this.preferLocalNode = conf.getBoolean(
DFSConfigKeys.
DFS_NAMENODE_BLOCKPLACEMENTPOLICY_DEFAULT_PREFER_LOCAL_NODE_KEY,
DFSConfigKeys.
DFS_NAMENODE_BLOCKPLACEMENTPOLICY_DEFAULT_PREFER_LOCAL_NODE_DEFAULT);
}
@Override

View File

@ -797,6 +797,18 @@
</description>
</property>
<property>
<name>dfs.namenode.block-placement-policy.default.prefer-local-node</name>
<value>true</value>
<description>Controls how the default block placement policy places
the first replica of a block. When true, it will prefer the node where
the client is running. When false, it will prefer a node in the same rack
as the client. Setting to false avoids situations where entire copies of
large files end up on a single node, thus creating hotspots.
</description>
</property>
<property>
<name>dfs.stream-buffer-size</name>
<value>4096</value>