From c34ceb5fde9f6d3d692640eb2a27d97990f17350 Mon Sep 17 00:00:00 2001 From: Eric Yang Date: Thu, 18 Jul 2019 12:30:53 -0400 Subject: [PATCH] YARN-9568. Fixed NPE in MiniYarnCluster during FileSystemNodeAttributeStore.recover. Contributed by Steve Loughran --- .../org/apache/hadoop/yarn/server/MiniYARNCluster.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-tests/src/test/java/org/apache/hadoop/yarn/server/MiniYARNCluster.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-tests/src/test/java/org/apache/hadoop/yarn/server/MiniYARNCluster.java index 5edd3ca342..68d97ee32a 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-tests/src/test/java/org/apache/hadoop/yarn/server/MiniYARNCluster.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-tests/src/test/java/org/apache/hadoop/yarn/server/MiniYARNCluster.java @@ -313,7 +313,13 @@ public class MiniYARNCluster extends CompositeService { YarnConfiguration.DEFAULT_TIMELINE_SERVICE_ENABLED) || enableAHS) { addService(new ApplicationHistoryServerWrapper()); } - + // to ensure that any FileSystemNodeAttributeStore started by the RM always + // uses a unique path, if unset, force it under the test dir. + if (conf.get(YarnConfiguration.FS_NODE_ATTRIBUTE_STORE_ROOT_DIR) == null) { + File nodeAttrDir = new File(getTestWorkDir(), "nodeattributes"); + conf.set(YarnConfiguration.FS_NODE_ATTRIBUTE_STORE_ROOT_DIR, + nodeAttrDir.getCanonicalPath()); + } super.serviceInit( conf instanceof YarnConfiguration ? conf : new YarnConfiguration(conf)); }