hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yu...@apache.org
Subject hadoop git commit: YARN-6582. FSAppAttempt demand can be updated atomically in updateDemand(). (Karthik Kambatla via Yufei Gu)
Date Thu, 25 May 2017 21:30:24 GMT
Repository: hadoop
Updated Branches:
  refs/heads/branch-2 4c44ff69d -> fc6cb4b2d


YARN-6582. FSAppAttempt demand can be updated atomically in updateDemand(). (Karthik Kambatla
via Yufei Gu)

(cherry picked from commit 87590090c887829e874a7132be9cf8de061437d6)


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

Branch: refs/heads/branch-2
Commit: fc6cb4b2dd90400a83e44e6177d83666b16af14f
Parents: 4c44ff6
Author: Yufei Gu <yufei@apache.org>
Authored: Thu May 25 14:22:13 2017 -0700
Committer: Yufei Gu <yufei@apache.org>
Committed: Thu May 25 14:25:49 2017 -0700

----------------------------------------------------------------------
 .../scheduler/fair/FSAppAttempt.java            | 23 +++++++++-----------
 1 file changed, 10 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/fc6cb4b2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/FSAppAttempt.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/scheduler/fair/FSAppAttempt.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/FSAppAttempt.java
index c8c0c32..80914cd 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/FSAppAttempt.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/FSAppAttempt.java
@@ -1284,24 +1284,21 @@ public class FSAppAttempt extends SchedulerApplicationAttempt
 
   @Override
   public void updateDemand() {
-    demand = Resources.createResource(0);
     // Demand is current consumption plus outstanding requests
-    Resources.addTo(demand, getCurrentConsumption());
+    Resource tmpDemand = Resources.clone(getCurrentConsumption());
 
     // Add up outstanding resource requests
-    try {
-      writeLock.lock();
-      for (SchedulerRequestKey k : getSchedulerKeys()) {
-        PendingAsk pendingAsk = getPendingAsk(k, ResourceRequest.ANY);
-        if (pendingAsk.getCount() > 0) {
-          Resources.multiplyAndAddTo(demand,
-              pendingAsk.getPerAllocationResource(),
-              pendingAsk.getCount());
-        }
+    for (SchedulerRequestKey k : getSchedulerKeys()) {
+      PendingAsk pendingAsk = getPendingAsk(k, ResourceRequest.ANY);
+      if (pendingAsk.getCount() > 0) {
+        Resources.multiplyAndAddTo(tmpDemand,
+            pendingAsk.getPerAllocationResource(),
+            pendingAsk.getCount());
       }
-    } finally {
-      writeLock.unlock();
     }
+
+    // Update demand
+    demand = tmpDemand;
   }
 
   @Override


---------------------------------------------------------------------
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