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

View File

@ -313,7 +313,13 @@ public void serviceInit(Configuration conf) throws Exception {
YarnConfiguration.DEFAULT_TIMELINE_SERVICE_ENABLED) || enableAHS) { YarnConfiguration.DEFAULT_TIMELINE_SERVICE_ENABLED) || enableAHS) {
addService(new ApplicationHistoryServerWrapper()); 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( super.serviceInit(
conf instanceof YarnConfiguration ? conf : new YarnConfiguration(conf)); conf instanceof YarnConfiguration ? conf : new YarnConfiguration(conf));
} }