MAPREDUCE-3147. Handle leaf queues with the same name properly. (Ravi Prakash via mahadev) - Merging r1211243 from trunk.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.23@1211247 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
194f52bbad
commit
740e269b8f
|
@ -200,6 +200,9 @@ Release 0.23.1 - Unreleased
|
||||||
MAPREDUCE-3496. Fixed client to print queue acls in consistent order.
|
MAPREDUCE-3496. Fixed client to print queue acls in consistent order.
|
||||||
(Jonathan Eagles via acmurthy)
|
(Jonathan Eagles via acmurthy)
|
||||||
|
|
||||||
|
MAPREDUCE-3147. Handle leaf queues with the same name properly.
|
||||||
|
(Ravi Prakash via mahadev)
|
||||||
|
|
||||||
Release 0.23.0 - 2011-11-01
|
Release 0.23.0 - 2011-11-01
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -214,7 +214,8 @@ implements ResourceScheduler, CapacitySchedulerContext {
|
||||||
private static final QueueHook noop = new QueueHook();
|
private static final QueueHook noop = new QueueHook();
|
||||||
|
|
||||||
@Lock(CapacityScheduler.class)
|
@Lock(CapacityScheduler.class)
|
||||||
private void initializeQueues(CapacitySchedulerConfiguration conf) {
|
private void initializeQueues(CapacitySchedulerConfiguration conf)
|
||||||
|
throws IOException {
|
||||||
root =
|
root =
|
||||||
parseQueue(this, conf, null, ROOT, queues, queues,
|
parseQueue(this, conf, null, ROOT, queues, queues,
|
||||||
queueComparator, applicationComparator, noop);
|
queueComparator, applicationComparator, noop);
|
||||||
|
@ -283,7 +284,7 @@ implements ResourceScheduler, CapacitySchedulerContext {
|
||||||
Map<String, CSQueue> oldQueues,
|
Map<String, CSQueue> oldQueues,
|
||||||
Comparator<CSQueue> queueComparator,
|
Comparator<CSQueue> queueComparator,
|
||||||
Comparator<SchedulerApp> applicationComparator,
|
Comparator<SchedulerApp> applicationComparator,
|
||||||
QueueHook hook) {
|
QueueHook hook) throws IOException {
|
||||||
CSQueue queue;
|
CSQueue queue;
|
||||||
String[] childQueueNames =
|
String[] childQueueNames =
|
||||||
conf.getQueues((parent == null) ?
|
conf.getQueues((parent == null) ?
|
||||||
|
@ -316,6 +317,11 @@ implements ResourceScheduler, CapacitySchedulerContext {
|
||||||
parentQueue.setChildQueues(childQueues);
|
parentQueue.setChildQueues(childQueues);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(queue instanceof LeafQueue == true && queues.containsKey(queueName)
|
||||||
|
&& queues.get(queueName) instanceof LeafQueue == true) {
|
||||||
|
throw new IOException("Two leaf queues were named " + queueName
|
||||||
|
+ ". Leaf queue names must be distinct");
|
||||||
|
}
|
||||||
queues.put(queueName, queue);
|
queues.put(queueName, queue);
|
||||||
|
|
||||||
LOG.info("Initialized queue: " + queue);
|
LOG.info("Initialized queue: " + queue);
|
||||||
|
|
|
@ -20,6 +20,7 @@ package org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity;
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
import static org.mockito.Mockito.*;
|
import static org.mockito.Mockito.*;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@ -44,7 +45,7 @@ public class TestApplicationLimits {
|
||||||
LeafQueue queue;
|
LeafQueue queue;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() throws IOException {
|
||||||
CapacitySchedulerConfiguration csConf =
|
CapacitySchedulerConfiguration csConf =
|
||||||
new CapacitySchedulerConfiguration();
|
new CapacitySchedulerConfiguration();
|
||||||
setupQueueConfiguration(csConf);
|
setupQueueConfiguration(csConf);
|
||||||
|
|
|
@ -240,4 +240,21 @@ public class TestCapacityScheduler {
|
||||||
node.checkResourceUsage();
|
node.checkResourceUsage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Test that parseQueue throws an exception when two leaf queues have the
|
||||||
|
* same name
|
||||||
|
* @throws IOException
|
||||||
|
*/
|
||||||
|
@Test(expected=IOException.class)
|
||||||
|
public void testParseQueue() throws IOException {
|
||||||
|
CapacityScheduler cs = new CapacityScheduler();
|
||||||
|
|
||||||
|
CapacitySchedulerConfiguration conf = new CapacitySchedulerConfiguration();
|
||||||
|
setupQueueConfiguration(conf);
|
||||||
|
conf.setQueues(CapacityScheduler.ROOT + ".a.a1", new String[] {"b1"} );
|
||||||
|
conf.setCapacity(CapacityScheduler.ROOT + ".a.a1.b1", 100);
|
||||||
|
conf.setUserLimitFactor(CapacityScheduler.ROOT + ".a.a1.b1", 100.0f);
|
||||||
|
|
||||||
|
cs.reinitialize(conf, null, null);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue