MAPREDUCE-4492. Configuring total queue capacity between 100.5 and 99.5 at perticular level is sucessfull (Mayank Bansal via bobby)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1367719 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Joseph Evans 2012-07-31 19:34:29 +00:00
parent 735b50e8bd
commit 89c59bbe3d
3 changed files with 61 additions and 1 deletions

View File

@ -774,6 +774,9 @@ Release 0.23.3 - UNRELEASED
MAPREDUCE-4493. Distibuted Cache Compatability Issues (Robert Evans
via tgraves)
MAPREDUCE-4492. Configuring total queue capacity between 100.5 and 99.5 at
perticular level is sucessfull (Mayank Bansal via bobby)
Release 0.23.2 - UNRELEASED
INCOMPATIBLE CHANGES

View File

@ -193,7 +193,7 @@ public class ParentQueue implements CSQueue {
", acls=" + aclsString);
}
private static float PRECISION = 0.005f; // 0.05% precision
private static float PRECISION = 0.0005f; // 0.05% precision
void setChildQueues(Collection<CSQueue> childQueues) {
// Validate

View File

@ -34,6 +34,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import junit.framework.Assert;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.security.UserGroupInformation;
@ -270,6 +272,61 @@ public class TestParentQueue {
verifyQueueMetrics(b, 9*GB, clusterResource);
}
@Test
public void testSingleLevelQueuesPrecision() throws Exception {
// Setup queue configs
setupSingleLevelQueues(csConf);
final String Q_A = CapacitySchedulerConfiguration.ROOT + "." + "a";
csConf.setCapacity(Q_A, 30);
final String Q_B = CapacitySchedulerConfiguration.ROOT + "." + "b";
csConf.setCapacity(Q_B, 70.5F);
Map<String, CSQueue> queues = new HashMap<String, CSQueue>();
boolean exceptionOccured = false;
try {
CapacityScheduler.parseQueue(csContext, csConf, null,
CapacitySchedulerConfiguration.ROOT, queues, queues,
CapacityScheduler.queueComparator,
CapacityScheduler.applicationComparator, TestUtils.spyHook);
} catch (IllegalArgumentException ie) {
exceptionOccured = true;
}
if (!exceptionOccured) {
Assert.fail("Capacity is more then 100% so should be failed.");
}
csConf.setCapacity(Q_A, 30);
csConf.setCapacity(Q_B, 70);
exceptionOccured = false;
queues.clear();
try {
CapacityScheduler.parseQueue(csContext, csConf, null,
CapacitySchedulerConfiguration.ROOT, queues, queues,
CapacityScheduler.queueComparator,
CapacityScheduler.applicationComparator, TestUtils.spyHook);
} catch (IllegalArgumentException ie) {
exceptionOccured = true;
}
if (exceptionOccured) {
Assert.fail("Capacity is 100% so should not be failed.");
}
csConf.setCapacity(Q_A, 30);
csConf.setCapacity(Q_B, 70.005F);
exceptionOccured = false;
queues.clear();
try {
CapacityScheduler.parseQueue(csContext, csConf, null,
CapacitySchedulerConfiguration.ROOT, queues, queues,
CapacityScheduler.queueComparator,
CapacityScheduler.applicationComparator, TestUtils.spyHook);
} catch (IllegalArgumentException ie) {
exceptionOccured = true;
}
if (exceptionOccured) {
Assert
.fail("Capacity is under PRECISION which is .05% so should not be failed.");
}
}
private static final String C = "c";
private static final String C1 = "c1";
private static final String C11 = "c11";