From 47420ae3edb9076d3aac7775de8712a7685dc135 Mon Sep 17 00:00:00 2001 From: Eric Badger Date: Mon, 22 Feb 2021 18:48:14 +0000 Subject: [PATCH] YARN-10647. Fix TestRMNodeLabelsManager failed after YARN-10501. Contributed by Qi Zhu. --- .../hadoop/yarn/nodelabels/CommonNodeLabelsManager.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 8fd0315fa85..5b9382fcff2 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 @@ -646,7 +646,9 @@ public class CommonNodeLabelsManager extends AbstractService { host.labels.addAll(labels); for (Node node : host.nms.values()) { replaceNodeForLabels(node.nodeId, node.labels, labels); - replaceLabelsForNode(node.nodeId, node.labels, labels); + if (node.labels != null && labels != null) { + replaceLabelsForNode(node.nodeId, node.labels, labels); + } node.labels = null; } break;