| 
191 | 191 | import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_NAMENODE_AVOID_SLOW_DATANODE_FOR_READ_DEFAULT;  | 
192 | 192 | import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_NAMENODE_BLOCKPLACEMENTPOLICY_EXCLUDE_SLOW_NODES_ENABLED_KEY;  | 
193 | 193 | import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_NAMENODE_BLOCKPLACEMENTPOLICY_EXCLUDE_SLOW_NODES_ENABLED_DEFAULT;  | 
 | 194 | +import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_NAMENODE_MAX_SLOWPEER_COLLECT_NODES_KEY;  | 
 | 195 | +import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_NAMENODE_MAX_SLOWPEER_COLLECT_NODES_DEFAULT;  | 
194 | 196 | 
 
  | 
195 | 197 | import static org.apache.hadoop.util.ExitUtil.terminate;  | 
196 | 198 | import static org.apache.hadoop.util.ToolRunner.confirmPrompt;  | 
@@ -334,7 +336,8 @@ public enum OperationCategory {  | 
334 | 336 |           DFS_BLOCK_PLACEMENT_EC_CLASSNAME_KEY,  | 
335 | 337 |           DFS_IMAGE_PARALLEL_LOAD_KEY,  | 
336 | 338 |           DFS_NAMENODE_AVOID_SLOW_DATANODE_FOR_READ_KEY,  | 
337 |  | -          DFS_NAMENODE_BLOCKPLACEMENTPOLICY_EXCLUDE_SLOW_NODES_ENABLED_KEY));  | 
 | 339 | +          DFS_NAMENODE_BLOCKPLACEMENTPOLICY_EXCLUDE_SLOW_NODES_ENABLED_KEY,  | 
 | 340 | +          DFS_NAMENODE_MAX_SLOWPEER_COLLECT_NODES_KEY));  | 
338 | 341 | 
 
  | 
339 | 342 |   private static final String USAGE = "Usage: hdfs namenode ["  | 
340 | 343 |       + StartupOption.BACKUP.getName() + "] | \n\t["  | 
@@ -2204,7 +2207,8 @@ protected String reconfigurePropertyImpl(String property, String newVal)  | 
2204 | 2207 |     } else if (property.equals(DFS_IMAGE_PARALLEL_LOAD_KEY)) {  | 
2205 | 2208 |       return reconfigureParallelLoad(newVal);  | 
2206 | 2209 |     } else if (property.equals(DFS_NAMENODE_AVOID_SLOW_DATANODE_FOR_READ_KEY)  | 
2207 |  | -          || (property.equals(DFS_NAMENODE_BLOCKPLACEMENTPOLICY_EXCLUDE_SLOW_NODES_ENABLED_KEY))) {  | 
 | 2210 | +          || (property.equals(DFS_NAMENODE_BLOCKPLACEMENTPOLICY_EXCLUDE_SLOW_NODES_ENABLED_KEY))  | 
 | 2211 | +          || (property.equals(DFS_NAMENODE_MAX_SLOWPEER_COLLECT_NODES_KEY))) {  | 
2208 | 2212 |       return reconfigureSlowNodesParameters(datanodeManager, property, newVal);  | 
2209 | 2213 |     } else {  | 
2210 | 2214 |       throw new ReconfigurationException(property, newVal, getConf().get(  | 
@@ -2396,24 +2400,32 @@ String reconfigureSlowNodesParameters(final DatanodeManager datanodeManager,  | 
2396 | 2400 |       final String property, final String newVal) throws ReconfigurationException {  | 
2397 | 2401 |     BlockManager bm = namesystem.getBlockManager();  | 
2398 | 2402 |     namesystem.writeLock();  | 
2399 |  | -    boolean enable;  | 
 | 2403 | +    String result;  | 
2400 | 2404 |     try {  | 
2401 | 2405 |       if (property.equals(DFS_NAMENODE_AVOID_SLOW_DATANODE_FOR_READ_KEY)) {  | 
2402 |  | -        enable = (newVal == null ? DFS_NAMENODE_AVOID_SLOW_DATANODE_FOR_READ_DEFAULT :  | 
 | 2406 | +        boolean enable = (newVal == null ? DFS_NAMENODE_AVOID_SLOW_DATANODE_FOR_READ_DEFAULT :  | 
2403 | 2407 |             Boolean.parseBoolean(newVal));  | 
 | 2408 | +        result = Boolean.toString(enable);  | 
2404 | 2409 |         datanodeManager.setAvoidSlowDataNodesForReadEnabled(enable);  | 
2405 | 2410 |       } else if (property.equals(  | 
2406 | 2411 |             DFS_NAMENODE_BLOCKPLACEMENTPOLICY_EXCLUDE_SLOW_NODES_ENABLED_KEY)) {  | 
2407 |  | -        enable = (newVal == null ?  | 
 | 2412 | +        boolean enable = (newVal == null ?  | 
2408 | 2413 |             DFS_NAMENODE_BLOCKPLACEMENTPOLICY_EXCLUDE_SLOW_NODES_ENABLED_DEFAULT :  | 
2409 | 2414 |             Boolean.parseBoolean(newVal));  | 
 | 2415 | +        result = Boolean.toString(enable);  | 
2410 | 2416 |         bm.setExcludeSlowNodesEnabled(enable);  | 
 | 2417 | +      } else if (property.equals(DFS_NAMENODE_MAX_SLOWPEER_COLLECT_NODES_KEY)) {  | 
 | 2418 | +        int maxSlowpeerCollectNodes = (newVal == null ?  | 
 | 2419 | +            DFS_NAMENODE_MAX_SLOWPEER_COLLECT_NODES_DEFAULT :  | 
 | 2420 | +            Integer.parseInt(newVal));  | 
 | 2421 | +        result = Integer.toString(maxSlowpeerCollectNodes);  | 
 | 2422 | +        datanodeManager.setMaxSlowpeerCollectNodes(maxSlowpeerCollectNodes);  | 
2411 | 2423 |       } else {  | 
2412 | 2424 |         throw new IllegalArgumentException("Unexpected property " +  | 
2413 | 2425 |             property + " in reconfigureSlowNodesParameters");  | 
2414 | 2426 |       }  | 
2415 | 2427 |       LOG.info("RECONFIGURE* changed {} to {}", property, newVal);  | 
2416 |  | -      return Boolean.toString(enable);  | 
 | 2428 | +      return result;  | 
2417 | 2429 |     } catch (IllegalArgumentException e) {  | 
2418 | 2430 |       throw new ReconfigurationException(property, newVal, getConf().get(  | 
2419 | 2431 |           property), e);  | 
 | 
0 commit comments