|
@@ -188,6 +188,8 @@ import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_BLOCK_REPLICATOR_CLASSNAM
|
|
|
import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_BLOCK_PLACEMENT_EC_CLASSNAME_KEY;
|
|
|
import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_NAMENODE_AVOID_SLOW_DATANODE_FOR_READ_KEY;
|
|
|
import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_NAMENODE_AVOID_SLOW_DATANODE_FOR_READ_DEFAULT;
|
|
|
+import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_NAMENODE_BLOCKPLACEMENTPOLICY_EXCLUDE_SLOW_NODES_ENABLED_KEY;
|
|
|
+import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_NAMENODE_BLOCKPLACEMENTPOLICY_EXCLUDE_SLOW_NODES_ENABLED_DEFAULT;
|
|
|
|
|
|
import static org.apache.hadoop.util.ExitUtil.terminate;
|
|
|
import static org.apache.hadoop.util.ToolRunner.confirmPrompt;
|
|
@@ -330,7 +332,8 @@ public class NameNode extends ReconfigurableBase implements
|
|
|
DFS_BLOCK_REPLICATOR_CLASSNAME_KEY,
|
|
|
DFS_BLOCK_PLACEMENT_EC_CLASSNAME_KEY,
|
|
|
DFS_IMAGE_PARALLEL_LOAD_KEY,
|
|
|
- DFS_NAMENODE_AVOID_SLOW_DATANODE_FOR_READ_KEY));
|
|
|
+ DFS_NAMENODE_AVOID_SLOW_DATANODE_FOR_READ_KEY,
|
|
|
+ DFS_NAMENODE_BLOCKPLACEMENTPOLICY_EXCLUDE_SLOW_NODES_ENABLED_KEY));
|
|
|
|
|
|
private static final String USAGE = "Usage: hdfs namenode ["
|
|
|
+ StartupOption.BACKUP.getName() + "] | \n\t["
|
|
@@ -2196,7 +2199,8 @@ public class NameNode extends ReconfigurableBase implements
|
|
|
return newVal;
|
|
|
} else if (property.equals(DFS_IMAGE_PARALLEL_LOAD_KEY)) {
|
|
|
return reconfigureParallelLoad(newVal);
|
|
|
- } else if (property.equals(DFS_NAMENODE_AVOID_SLOW_DATANODE_FOR_READ_KEY)) {
|
|
|
+ } else if (property.equals(DFS_NAMENODE_AVOID_SLOW_DATANODE_FOR_READ_KEY)
|
|
|
+ || (property.equals(DFS_NAMENODE_BLOCKPLACEMENTPOLICY_EXCLUDE_SLOW_NODES_ENABLED_KEY))) {
|
|
|
return reconfigureSlowNodesParameters(datanodeManager, property, newVal);
|
|
|
} else {
|
|
|
throw new ReconfigurationException(property, newVal, getConf().get(
|
|
@@ -2230,7 +2234,7 @@ public class NameNode extends ReconfigurableBase implements
|
|
|
newSetting = bm.getBlocksReplWorkMultiplier();
|
|
|
} else {
|
|
|
throw new IllegalArgumentException("Unexpected property " +
|
|
|
- property + "in reconfReplicationParameters");
|
|
|
+ property + " in reconfReplicationParameters");
|
|
|
}
|
|
|
LOG.info("RECONFIGURE* changed {} to {}", property, newSetting);
|
|
|
return String.valueOf(newSetting);
|
|
@@ -2386,15 +2390,24 @@ public class NameNode extends ReconfigurableBase implements
|
|
|
|
|
|
String reconfigureSlowNodesParameters(final DatanodeManager datanodeManager,
|
|
|
final String property, final String newVal) throws ReconfigurationException {
|
|
|
+ BlockManager bm = namesystem.getBlockManager();
|
|
|
namesystem.writeLock();
|
|
|
boolean enable;
|
|
|
try {
|
|
|
- if (newVal == null) {
|
|
|
- enable = DFS_NAMENODE_AVOID_SLOW_DATANODE_FOR_READ_DEFAULT;
|
|
|
+ if (property.equals(DFS_NAMENODE_AVOID_SLOW_DATANODE_FOR_READ_KEY)) {
|
|
|
+ enable = (newVal == null ? DFS_NAMENODE_AVOID_SLOW_DATANODE_FOR_READ_DEFAULT :
|
|
|
+ Boolean.parseBoolean(newVal));
|
|
|
+ datanodeManager.setAvoidSlowDataNodesForReadEnabled(enable);
|
|
|
+ } else if (property.equals(
|
|
|
+ DFS_NAMENODE_BLOCKPLACEMENTPOLICY_EXCLUDE_SLOW_NODES_ENABLED_KEY)) {
|
|
|
+ enable = (newVal == null ?
|
|
|
+ DFS_NAMENODE_BLOCKPLACEMENTPOLICY_EXCLUDE_SLOW_NODES_ENABLED_DEFAULT :
|
|
|
+ Boolean.parseBoolean(newVal));
|
|
|
+ bm.setExcludeSlowNodesEnabled(enable);
|
|
|
} else {
|
|
|
- enable = Boolean.parseBoolean(newVal);
|
|
|
+ throw new IllegalArgumentException("Unexpected property " +
|
|
|
+ property + " in reconfigureSlowNodesParameters");
|
|
|
}
|
|
|
- datanodeManager.setAvoidSlowDataNodesForReadEnabled(enable);
|
|
|
LOG.info("RECONFIGURE* changed {} to {}", property, newVal);
|
|
|
return Boolean.toString(enable);
|
|
|
} catch (IllegalArgumentException e) {
|