YARN-881. Priority#compareTo method seems to be wrong. (Jian He via bikas)
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1516331 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2d614a916c
commit
42a2846b3b
|
@ -80,6 +80,8 @@ Release 2.1.1-beta - UNRELEASED
|
|||
YARN-1006. Fixed broken rendering in the Nodes list web page on the RM web
|
||||
UI. (Xuan Gong via vinodkv)
|
||||
|
||||
YARN-881. Priority#compareTo method seems to be wrong. (Jian He via bikas)
|
||||
|
||||
Release 2.1.0-beta - 2013-08-22
|
||||
|
||||
INCOMPATIBLE CHANGES
|
||||
|
|
|
@ -81,7 +81,7 @@ public abstract class Priority implements Comparable<Priority> {
|
|||
|
||||
@Override
|
||||
public int compareTo(Priority other) {
|
||||
return this.getPriority() - other.getPriority();
|
||||
return other.getPriority() - this.getPriority();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -385,8 +385,8 @@ public class FairScheduler implements ResourceScheduler {
|
|||
// Sort containers into reverse order of priority
|
||||
Collections.sort(runningContainers, new Comparator<RMContainer>() {
|
||||
public int compare(RMContainer c1, RMContainer c2) {
|
||||
int ret = c2.getContainer().getPriority().compareTo(
|
||||
c1.getContainer().getPriority());
|
||||
int ret = c1.getContainer().getPriority().compareTo(
|
||||
c2.getContainer().getPriority());
|
||||
if (ret == 0) {
|
||||
return c2.getContainerId().compareTo(c1.getContainerId());
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
package org.apache.hadoop.yarn.server.resourcemanager.scheduler;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
|
@ -351,4 +352,10 @@ public class TestSchedulerUtils {
|
|||
RMAppAttemptState.LAUNCHED);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testComparePriorities(){
|
||||
Priority high = Priority.newInstance(1);
|
||||
Priority low = Priority.newInstance(2);
|
||||
assertTrue(high.compareTo(low) > 0);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue