hadoop-yarn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vino...@apache.org
Subject svn commit: r1554329 - in /hadoop/common/branches/branch-2/hadoop-yarn-project: CHANGES.txt hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestApplicationCleanup.java
Date Mon, 30 Dec 2013 22:22:25 GMT
Author: vinodkv
Date: Mon Dec 30 22:22:24 2013
New Revision: 1554329

URL: http://svn.apache.org/r1554329
Log:
YARN-1522. Fixed a race condition in the test TestApplicationCleanup that was causing it to
randomly fail. Contributed by Liyin Liang.
svn merge --ignore-ancestry -c 1554328 ../../trunk/

Modified:
    hadoop/common/branches/branch-2/hadoop-yarn-project/CHANGES.txt
    hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestApplicationCleanup.java

Modified: hadoop/common/branches/branch-2/hadoop-yarn-project/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-yarn-project/CHANGES.txt?rev=1554329&r1=1554328&r2=1554329&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-yarn-project/CHANGES.txt (original)
+++ hadoop/common/branches/branch-2/hadoop-yarn-project/CHANGES.txt Mon Dec 30 22:22:24 2013
@@ -259,6 +259,9 @@ Release 2.4.0 - UNRELEASED
     YARN-1527. Fix yarn rmadmin command to print the correct usage info.
     (Akira AJISAKA via jianhe)
 
+    YARN-1522. Fixed a race condition in the test TestApplicationCleanup that was
+    causing it to randomly fail. (Liyin Liang via vinodkv)
+
 Release 2.3.0 - UNRELEASED
 
   INCOMPATIBLE CHANGES

Modified: hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestApplicationCleanup.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestApplicationCleanup.java?rev=1554329&r1=1554328&r2=1554329&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestApplicationCleanup.java
(original)
+++ hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestApplicationCleanup.java
Mon Dec 30 22:22:24 2013
@@ -100,26 +100,32 @@ public class TestApplicationCleanup {
     //currently only containers are cleaned via this
     //AM container is cleaned via container launcher
     resp = nm1.nodeHeartbeat(true);
-    List<ContainerId> contsToClean = resp.getContainersToCleanup();
-    List<ApplicationId> apps = resp.getApplicationsToCleanup();
-    int cleanedConts = contsToClean.size();
-    int cleanedApps = apps.size();
+    List<ContainerId> containersToCleanup = resp.getContainersToCleanup();
+    List<ApplicationId> appsToCleanup = resp.getApplicationsToCleanup();
+    int numCleanedContainers = containersToCleanup.size();
+    int numCleanedApps = appsToCleanup.size();
     waitCount = 0;
-    while ((cleanedConts < 2 || cleanedApps < 1) && waitCount++ < 200) {
+    while ((numCleanedContainers < 2 || numCleanedApps < 1)
+        && waitCount++ < 200) {
       LOG.info("Waiting to get cleanup events.. cleanedConts: "
-          + cleanedConts + " cleanedApps: " + cleanedApps);
+          + numCleanedContainers + " cleanedApps: " + numCleanedApps);
       Thread.sleep(100);
       resp = nm1.nodeHeartbeat(true);
-      contsToClean = resp.getContainersToCleanup();
-      apps = resp.getApplicationsToCleanup();
-      cleanedConts += contsToClean.size();
-      cleanedApps += apps.size();
+      List<ContainerId> deltaContainersToCleanup =
+          resp.getContainersToCleanup();
+      List<ApplicationId> deltaAppsToCleanup = resp.getApplicationsToCleanup();
+      // Add the deltas to the global list
+      containersToCleanup.addAll(deltaContainersToCleanup);
+      appsToCleanup.addAll(deltaAppsToCleanup);
+      // Update counts now
+      numCleanedContainers = containersToCleanup.size();
+      numCleanedApps = appsToCleanup.size();
     }
     
-    Assert.assertEquals(1, apps.size());
-    Assert.assertEquals(app.getApplicationId(), apps.get(0));
-    Assert.assertEquals(1, cleanedApps);
-    Assert.assertEquals(2, cleanedConts);
+    Assert.assertEquals(1, appsToCleanup.size());
+    Assert.assertEquals(app.getApplicationId(), appsToCleanup.get(0));
+    Assert.assertEquals(1, numCleanedApps);
+    Assert.assertEquals(2, numCleanedContainers);
 
     rm.stop();
   }



Mime
View raw message