YARN-7051. Avoid concurrent modification exception in FifoIntraQueuePreemptionPlugin. Contributed by Eric Payne.
This commit is contained in:
parent
ae7abad3d9
commit
02599bda04
|
@ -397,10 +397,16 @@ public class FifoIntraQueuePreemptionPlugin
|
||||||
ResourceUsage userResourceUsage = tq.leafQueue.getUser(userName)
|
ResourceUsage userResourceUsage = tq.leafQueue.getUser(userName)
|
||||||
.getResourceUsage();
|
.getResourceUsage();
|
||||||
|
|
||||||
|
// perUserAMUsed was populated with running apps, now we are looping
|
||||||
|
// through both running and pending apps.
|
||||||
|
Resource userSpecificAmUsed = perUserAMUsed.get(userName);
|
||||||
|
amUsed = (userSpecificAmUsed == null)
|
||||||
|
? Resources.none() : userSpecificAmUsed;
|
||||||
|
|
||||||
TempUserPerPartition tmpUser = new TempUserPerPartition(
|
TempUserPerPartition tmpUser = new TempUserPerPartition(
|
||||||
tq.leafQueue.getUser(userName), tq.queueName,
|
tq.leafQueue.getUser(userName), tq.queueName,
|
||||||
Resources.clone(userResourceUsage.getUsed(partition)),
|
Resources.clone(userResourceUsage.getUsed(partition)),
|
||||||
Resources.clone(perUserAMUsed.get(userName)),
|
Resources.clone(userSpecificAmUsed),
|
||||||
Resources.clone(userResourceUsage.getReserved(partition)),
|
Resources.clone(userResourceUsage.getReserved(partition)),
|
||||||
Resources.none());
|
Resources.none());
|
||||||
|
|
||||||
|
@ -547,6 +553,7 @@ public class FifoIntraQueuePreemptionPlugin
|
||||||
Collection<FiCaSchedulerApp> runningApps = leafQueue.getApplications();
|
Collection<FiCaSchedulerApp> runningApps = leafQueue.getApplications();
|
||||||
Resource amUsed = Resources.createResource(0, 0);
|
Resource amUsed = Resources.createResource(0, 0);
|
||||||
|
|
||||||
|
synchronized (leafQueue) {
|
||||||
for (FiCaSchedulerApp app : runningApps) {
|
for (FiCaSchedulerApp app : runningApps) {
|
||||||
Resource userAMResource = perUserAMUsed.get(app.getUser());
|
Resource userAMResource = perUserAMUsed.get(app.getUser());
|
||||||
if (null == userAMResource) {
|
if (null == userAMResource) {
|
||||||
|
@ -557,6 +564,7 @@ public class FifoIntraQueuePreemptionPlugin
|
||||||
Resources.addTo(userAMResource, app.getAMResource(partition));
|
Resources.addTo(userAMResource, app.getAMResource(partition));
|
||||||
Resources.addTo(amUsed, app.getAMResource(partition));
|
Resources.addTo(amUsed, app.getAMResource(partition));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return amUsed;
|
return amUsed;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue