hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jl...@apache.org
Subject hadoop git commit: MAPREDUCE-4784. TestRecovery occasionally fails. Contributed by Haibo Chen (cherry picked from commit f70f522e805b2d8dd49bae07fc65d37a78ad2fca)
Date Tue, 30 Aug 2016 14:12:50 GMT
Repository: hadoop
Updated Branches:
  refs/heads/branch-2.7 a9479f8f2 -> d499a8ccc


MAPREDUCE-4784. TestRecovery occasionally fails. Contributed by Haibo Chen
(cherry picked from commit f70f522e805b2d8dd49bae07fc65d37a78ad2fca)


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

Branch: refs/heads/branch-2.7
Commit: d499a8cccf97f54a9fd84f72a8fee7ec816afd22
Parents: a9479f8
Author: Jason Lowe <jlowe@apache.org>
Authored: Tue Aug 30 14:09:14 2016 +0000
Committer: Jason Lowe <jlowe@apache.org>
Committed: Tue Aug 30 14:11:49 2016 +0000

----------------------------------------------------------------------
 hadoop-mapreduce-project/CHANGES.txt            |  2 ++
 .../hadoop/mapreduce/v2/app/TestRecovery.java   | 28 +++++++++++++++-----
 2 files changed, 23 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/d499a8cc/hadoop-mapreduce-project/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-mapreduce-project/CHANGES.txt b/hadoop-mapreduce-project/CHANGES.txt
index c00d6ca..11af23e 100644
--- a/hadoop-mapreduce-project/CHANGES.txt
+++ b/hadoop-mapreduce-project/CHANGES.txt
@@ -18,6 +18,8 @@ Release 2.7.4 - UNRELEASED
     MAPREDUCE-6768. TestRecovery.testSpeculative failed with NPE (Haibo Chen
     via jlowe)
 
+    MAPREDUCE-4784. TestRecovery occasionally fails (Haibo Chen via jlowe)
+
 Release 2.7.3 - UNRELEASED
 
   INCOMPATIBLE CHANGES

http://git-wip-us.apache.org/repos/asf/hadoop/blob/d499a8cc/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/TestRecovery.java
----------------------------------------------------------------------
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/TestRecovery.java
b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/TestRecovery.java
index f59c147..d9f8e43 100644
--- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/TestRecovery.java
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/TestRecovery.java
@@ -35,6 +35,7 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
+import java.util.concurrent.TimeoutException;
 import org.junit.Assert;
 
 import org.apache.commons.logging.Log;
@@ -180,7 +181,10 @@ public class TestRecovery {
     Iterator<TaskAttempt> itr = mapTask1.getAttempts().values().iterator();
     itr.next();
     TaskAttempt task1Attempt2 = itr.next();
-    
+
+    // wait for the second task attempt to be assigned.
+    waitForContainerAssignment(task1Attempt2);
+
     // This attempt will automatically fail because of the way ContainerLauncher
     // is setup
     // This attempt 'disappears' from JobHistory and so causes MAPREDUCE-3846
@@ -318,6 +322,21 @@ public class TestRecovery {
   }
 
   /**
+   * Wait for a task attempt to be assigned a container to.
+   * @param task1Attempt2 the task attempt to wait for its container assignment
+   * @throws TimeoutException if times out
+   * @throws InterruptedException if interrupted
+   */
+  public static void waitForContainerAssignment(final TaskAttempt task1Attempt2)
+      throws TimeoutException, InterruptedException {
+    GenericTestUtils.waitFor(new Supplier<Boolean>() {
+      @Override public Boolean get() {
+        return task1Attempt2.getAssignedContainerID() != null;
+      }
+    }, 10, 10000);
+  }
+
+  /**
    * AM with 3 maps and 0 reduce. AM crashes after the first two tasks finishes
    * and recovers completely and succeeds in the second generation.
    * 
@@ -1197,14 +1216,9 @@ public class TestRecovery {
     TaskAttempt task1Attempt1 = t1it.next();
     TaskAttempt task1Attempt2 = t1it.next();
     TaskAttempt task2Attempt = mapTask2.getAttempts().values().iterator().next();
-    final TaskAttempt t2a = task2Attempt;
 
     // wait for the second task attempt to be assigned.
-    GenericTestUtils.waitFor(new Supplier<Boolean>() {
-      @Override public Boolean get() {
-        return t2a.getAssignedContainerID() != null;
-      }
-    }, 10, 10000);
+    waitForContainerAssignment(task1Attempt2);
     ContainerId t1a2contId = task1Attempt2.getAssignedContainerID();
 
     LOG.info(t1a2contId.toString());


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