YARN-461. Fair scheduler should not accept apps with empty string queue name. (ywskycn via tucu)
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1505858 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
5b3bb05fbe
commit
ca35ed13bf
|
@ -802,6 +802,9 @@ Release 2.1.0-beta - 2013-07-02
|
|||
YARN-909. Disable TestLinuxContainerExecutorWithMocks on Windows. (Chuan Liu
|
||||
via cnauroth)
|
||||
|
||||
YARN-461. Fair scheduler should not accept apps with empty string queue name.
|
||||
(ywskycn via tucu)
|
||||
|
||||
Release 2.0.5-alpha - 06/06/2013
|
||||
|
||||
INCOMPATIBLE CHANGES
|
||||
|
|
|
@ -604,6 +604,15 @@ public class FairScheduler implements ResourceScheduler {
|
|||
*/
|
||||
protected synchronized void addApplication(
|
||||
ApplicationAttemptId applicationAttemptId, String queueName, String user) {
|
||||
if (queueName == null || queueName.isEmpty()) {
|
||||
String message = "Reject application " + applicationAttemptId +
|
||||
" submitted by user " + user + " with an empty queue name.";
|
||||
LOG.info(message);
|
||||
rmContext.getDispatcher().getEventHandler().handle(
|
||||
new RMAppAttemptRejectedEvent(applicationAttemptId, message));
|
||||
return;
|
||||
}
|
||||
|
||||
RMApp rmApp = rmContext.getRMApps().get(applicationAttemptId);
|
||||
FSLeafQueue queue = assignToQueue(rmApp, queueName, user);
|
||||
|
||||
|
|
|
@ -559,6 +559,25 @@ public class TestFairScheduler {
|
|||
.getAppSchedulables().size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEmptyQueueName() throws Exception {
|
||||
Configuration conf = createConfiguration();
|
||||
|
||||
// only default queue
|
||||
assertEquals(1, scheduler.getQueueManager().getLeafQueues().size());
|
||||
|
||||
// submit app with empty queue
|
||||
ApplicationAttemptId appAttemptId = createAppAttemptId(1, 1);
|
||||
AppAddedSchedulerEvent appAddedEvent = new AppAddedSchedulerEvent(
|
||||
appAttemptId, "", "user1");
|
||||
scheduler.handle(appAddedEvent);
|
||||
|
||||
// submission rejected
|
||||
assertEquals(1, scheduler.getQueueManager().getLeafQueues().size());
|
||||
assertNull(scheduler.getSchedulerApp(appAttemptId));
|
||||
assertEquals(0, resourceManager.getRMContext().getRMApps().size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAssignToQueue() throws Exception {
|
||||
Configuration conf = createConfiguration();
|
||||
|
|
Loading…
Reference in New Issue