YARN-4416. Deadlock due to synchronised get Methods in AbstractCSQueue. (Naganarasimha G R via wangda)

(cherry picked from commit 9b856d9787)
(cherry picked from commit 5060fd1840)
This commit is contained in:
Wangda Tan 2015-12-16 13:22:37 -08:00
parent c4b1386b4e
commit b74391ce14
3 changed files with 6 additions and 20 deletions

View File

@ -1083,6 +1083,9 @@ Release 2.8.0 - UNRELEASED
YARN-4225. Add preemption status to yarn queue -status for capacity scheduler. YARN-4225. Add preemption status to yarn queue -status for capacity scheduler.
(Eric Payne via wangda) (Eric Payne via wangda)
YARN-4416. Deadlock due to synchronised get Methods in AbstractCSQueue.
(Naganarasimha G R via wangda)
Release 2.7.3 - UNRELEASED Release 2.7.3 - UNRELEASED
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -46,7 +46,6 @@ import org.apache.hadoop.yarn.server.resourcemanager.nodelabels.RMNodeLabelsMana
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.ResourceLimits; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.ResourceLimits;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.ResourceUsage; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.ResourceUsage;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerApplicationAttempt; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerApplicationAttempt;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedContainerChangeRequest;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerUtils; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerUtils;
import org.apache.hadoop.yarn.util.resource.ResourceCalculator; import org.apache.hadoop.yarn.util.resource.ResourceCalculator;
import org.apache.hadoop.yarn.util.resource.Resources; import org.apache.hadoop.yarn.util.resource.Resources;
@ -135,7 +134,7 @@ public abstract class AbstractCSQueue implements CSQueue {
} }
@Override @Override
public synchronized float getAbsoluteUsedCapacity() { public float getAbsoluteUsedCapacity() {
return queueCapacities.getAbsoluteUsedCapacity(); return queueCapacities.getAbsoluteUsedCapacity();
} }
@ -154,7 +153,7 @@ public abstract class AbstractCSQueue implements CSQueue {
return queueUsage.getUsed(); return queueUsage.getUsed();
} }
public synchronized int getNumContainers() { public int getNumContainers() {
return numContainers; return numContainers;
} }
@ -203,7 +202,7 @@ public abstract class AbstractCSQueue implements CSQueue {
} }
@Override @Override
public synchronized void setAbsoluteUsedCapacity(float absUsedCapacity) { public void setAbsoluteUsedCapacity(float absUsedCapacity) {
queueCapacities.setAbsoluteUsedCapacity(absUsedCapacity); queueCapacities.setAbsoluteUsedCapacity(absUsedCapacity);
} }

View File

@ -109,9 +109,6 @@ public class LeafQueue extends AbstractCSQueue {
// cache last cluster resource to compute actual capacity // cache last cluster resource to compute actual capacity
private Resource lastClusterResource = Resources.none(); private Resource lastClusterResource = Resources.none();
// absolute capacity as a resource (based on cluster resource)
private Resource absoluteCapacityResource = Resources.none();
private final QueueResourceLimitsInfo queueResourceLimitsInfo = private final QueueResourceLimitsInfo queueResourceLimitsInfo =
new QueueResourceLimitsInfo(); new QueueResourceLimitsInfo();
@ -144,7 +141,6 @@ public class LeafQueue extends AbstractCSQueue {
super.setupQueueConfigs(clusterResource); super.setupQueueConfigs(clusterResource);
this.lastClusterResource = clusterResource; this.lastClusterResource = clusterResource;
updateAbsoluteCapacityResource(clusterResource);
this.cachedResourceLimitsForHeadroom = new ResourceLimits(clusterResource); this.cachedResourceLimitsForHeadroom = new ResourceLimits(clusterResource);
@ -346,10 +342,6 @@ public class LeafQueue extends AbstractCSQueue {
return getUser(user).getActiveApplications(); return getUser(user).getActiveApplications();
} }
public synchronized int getNumContainers() {
return numContainers;
}
@Override @Override
public synchronized QueueState getState() { public synchronized QueueState getState() {
return state; return state;
@ -1327,13 +1319,6 @@ public class LeafQueue extends AbstractCSQueue {
} }
} }
private void updateAbsoluteCapacityResource(Resource clusterResource) {
absoluteCapacityResource =
Resources.multiplyAndNormalizeUp(resourceCalculator, labelManager
.getResourceByLabel(RMNodeLabelsManager.NO_LABEL, clusterResource),
queueCapacities.getAbsoluteCapacity(), minimumAllocation);
}
private void updateCurrentResourceLimits( private void updateCurrentResourceLimits(
ResourceLimits currentResourceLimits, Resource clusterResource) { ResourceLimits currentResourceLimits, Resource clusterResource) {
// TODO: need consider non-empty node labels when resource limits supports // TODO: need consider non-empty node labels when resource limits supports
@ -1359,7 +1344,6 @@ public class LeafQueue extends AbstractCSQueue {
ResourceLimits currentResourceLimits) { ResourceLimits currentResourceLimits) {
updateCurrentResourceLimits(currentResourceLimits, clusterResource); updateCurrentResourceLimits(currentResourceLimits, clusterResource);
lastClusterResource = clusterResource; lastClusterResource = clusterResource;
updateAbsoluteCapacityResource(clusterResource);
// Update headroom info based on new cluster resource value // Update headroom info based on new cluster resource value
// absoluteMaxCapacity now, will be replaced with absoluteMaxAvailCapacity // absoluteMaxCapacity now, will be replaced with absoluteMaxAvailCapacity