hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sun...@apache.org
Subject hadoop git commit: YARN-7051. Avoid concurrent modification exception in FifoIntraQueuePreemptionPlugin. Contributed by Eric Payne.
Date Mon, 28 Aug 2017 07:14:08 GMT
Repository: hadoop
Updated Branches:
  refs/heads/branch-2.8 8eb39f775 -> bc7307788


YARN-7051. Avoid concurrent modification exception in FifoIntraQueuePreemptionPlugin. Contributed
by Eric Payne.

(cherry picked from commit 02599bda04e0ef46f4628b006f2430ad63cac97e)


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/bc730778
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/bc730778
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/bc730778

Branch: refs/heads/branch-2.8
Commit: bc7307788c6a73873a7e058b42ce4b8820b26bd1
Parents: 8eb39f7
Author: Sunil G <sunilg@apache.org>
Authored: Mon Aug 28 12:22:56 2017 +0530
Committer: Sunil G <sunilg@apache.org>
Committed: Mon Aug 28 12:43:47 2017 +0530

----------------------------------------------------------------------
 .../FifoIntraQueuePreemptionPlugin.java         | 26 +++++++++++++-------
 1 file changed, 17 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/bc730778/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/monitor/capacity/FifoIntraQueuePreemptionPlugin.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/monitor/capacity/FifoIntraQueuePreemptionPlugin.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/monitor/capacity/FifoIntraQueuePreemptionPlugin.java
index 4bf6760..00ae3da 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/monitor/capacity/FifoIntraQueuePreemptionPlugin.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/monitor/capacity/FifoIntraQueuePreemptionPlugin.java
@@ -397,10 +397,16 @@ public class FifoIntraQueuePreemptionPlugin
         ResourceUsage userResourceUsage = tq.leafQueue.getUser(userName)
             .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(
             tq.leafQueue.getUser(userName), tq.queueName,
             Resources.clone(userResourceUsage.getUsed(partition)),
-            Resources.clone(perUserAMUsed.get(userName)),
+            Resources.clone(userSpecificAmUsed),
             Resources.clone(userResourceUsage.getReserved(partition)),
             Resources.none());
 
@@ -547,15 +553,17 @@ public class FifoIntraQueuePreemptionPlugin
     Collection<FiCaSchedulerApp> runningApps = leafQueue.getApplications();
     Resource amUsed = Resources.createResource(0, 0);
 
-    for (FiCaSchedulerApp app : runningApps) {
-      Resource userAMResource = perUserAMUsed.get(app.getUser());
-      if (null == userAMResource) {
-        userAMResource = Resources.createResource(0, 0);
-        perUserAMUsed.put(app.getUser(), userAMResource);
-      }
+    synchronized (leafQueue) {
+      for (FiCaSchedulerApp app : runningApps) {
+        Resource userAMResource = perUserAMUsed.get(app.getUser());
+        if (null == userAMResource) {
+          userAMResource = Resources.createResource(0, 0);
+          perUserAMUsed.put(app.getUser(), userAMResource);
+        }
 
-      Resources.addTo(userAMResource, app.getAMResource(partition));
-      Resources.addTo(amUsed, app.getAMResource(partition));
+        Resources.addTo(userAMResource, app.getAMResource(partition));
+        Resources.addTo(amUsed, app.getAMResource(partition));
+      }
     }
 
     return amUsed;


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message