YARN-11461. fix NPE in determineMissingParents (auto queue creation / CS). (#5506)
Change-Id: Iaaaf43a545588eaff8a0a20f6f3c27258a45f390
This commit is contained in:
parent
5cf62d1498
commit
69748aae32
|
@ -576,6 +576,11 @@ public class CapacitySchedulerQueueManager implements SchedulerQueueManager<
|
|||
firstExistingStaticParent = getQueue(parentCandidate.toString());
|
||||
}
|
||||
|
||||
if (firstExistingParent == null || firstExistingStaticParent == null) {
|
||||
throw new SchedulerDynamicEditException("Could not auto-create queue "
|
||||
+ queue + " parent queue does not exist.");
|
||||
}
|
||||
|
||||
int maximumDepthOfStaticParent = csContext.getConfiguration().getMaximumAutoCreatedQueueDepth(
|
||||
firstExistingStaticParent.getQueuePath());
|
||||
if (firstStaticParentDistance > maximumDepthOfStaticParent) {
|
||||
|
|
|
@ -1251,6 +1251,17 @@ public class TestCapacitySchedulerNewQueueAutoCreation
|
|||
Assert.assertNull("root.e.e1-auto should have been removed", eAuto);
|
||||
}
|
||||
|
||||
@Test()
|
||||
public void testAutoCreateInvalidParent() throws Exception {
|
||||
startScheduler();
|
||||
Assert.assertThrows(SchedulerDynamicEditException.class,
|
||||
() -> createQueue("invalid.queue"));
|
||||
Assert.assertThrows(SchedulerDynamicEditException.class,
|
||||
() -> createQueue("invalid.queue.longer"));
|
||||
Assert.assertThrows(SchedulerDynamicEditException.class,
|
||||
() -> createQueue("invalidQueue"));
|
||||
}
|
||||
|
||||
protected AbstractLeafQueue createQueue(String queuePath) throws YarnException,
|
||||
IOException {
|
||||
return autoQueueHandler.createQueue(new QueuePath(queuePath));
|
||||
|
|
Loading…
Reference in New Issue