diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index 7117fbdd68..fdf13beab4 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -287,6 +287,9 @@ Release 2.7.0 - UNRELEASED YARN-3158. Correct log messages in ResourceTrackerService. (Varun Saxena via xgong) + YARN-3179. Update use of Iterator to Iterable in RMAdminCLI and + CommonNodeLabelsManager. (Ray Chiang via xgong) + OPTIMIZATIONS YARN-2990. FairScheduler's delay-scheduling always waits for node-local and diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/RMAdminCLI.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/RMAdminCLI.java index af83102c96..d29f674131 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/RMAdminCLI.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/RMAdminCLI.java @@ -128,12 +128,12 @@ public RMAdminCLI(Configuration conf) { } private static void appendHAUsage(final StringBuilder usageBuilder) { - for (String cmdKey : USAGE.keySet()) { - if (cmdKey.equals("-help")) { + for (Map.Entry cmdEntry : USAGE.entrySet()) { + if (cmdEntry.getKey().equals("-help")) { continue; } - UsageInfo usageInfo = USAGE.get(cmdKey); - usageBuilder.append(" [" + cmdKey + " " + usageInfo.args + "]"); + UsageInfo usageInfo = cmdEntry.getValue(); + usageBuilder.append(" [" + cmdEntry.getKey() + " " + usageInfo.args + "]"); } } @@ -173,14 +173,15 @@ private static void buildIndividualUsageMsg(String cmd, private static void buildUsageMsg(StringBuilder builder, boolean isHAEnabled) { builder.append("Usage: yarn rmadmin\n"); - for (String cmdKey : ADMIN_USAGE.keySet()) { - UsageInfo usageInfo = ADMIN_USAGE.get(cmdKey); - builder.append(" " + cmdKey + " " + usageInfo.args + "\n"); + for (Map.Entry cmdEntry : ADMIN_USAGE.entrySet()) { + UsageInfo usageInfo = cmdEntry.getValue(); + builder.append(" " + cmdEntry.getKey() + " " + usageInfo.args + "\n"); } if (isHAEnabled) { - for (String cmdKey : USAGE.keySet()) { + for (Map.Entry cmdEntry : USAGE.entrySet()) { + String cmdKey = cmdEntry.getKey(); if (!cmdKey.equals("-help")) { - UsageInfo usageInfo = USAGE.get(cmdKey); + UsageInfo usageInfo = cmdEntry.getValue(); builder.append(" " + cmdKey + " " + usageInfo.args + "\n"); } } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/nodelabels/CommonNodeLabelsManager.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/nodelabels/CommonNodeLabelsManager.java index 25ff417320..cb6f1f3914 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/nodelabels/CommonNodeLabelsManager.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/nodelabels/CommonNodeLabelsManager.java @@ -383,8 +383,8 @@ protected void checkRemoveFromClusterNodeLabels( @SuppressWarnings("unchecked") protected void internalRemoveFromClusterNodeLabels(Collection labelsToRemove) { // remove labels from nodes - for (String nodeName : nodeCollections.keySet()) { - Host host = nodeCollections.get(nodeName); + for (Map.Entry nodeEntry : nodeCollections.entrySet()) { + Host host = nodeEntry.getValue(); if (null != host) { host.labels.removeAll(labelsToRemove); for (Node nm : host.nms.values()) {