YARN-9568. Fixed NPE in MiniYarnCluster during FileSystemNodeAttributeStore.recover.

Contributed by Steve Loughran
This commit is contained in:
Eric Yang 2019-07-18 12:30:53 -04:00
parent 8ef2365ffd
commit c34ceb5fde
1 changed files with 7 additions and 1 deletions

View File

@ -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));
}