You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by se...@apache.org on 2016/12/02 11:36:46 UTC

[1/2] flink git commit: [hotfix] Fix test instability in AbstractTaskManagerProcessFailureRecoveryTest

Repository: flink
Updated Branches:
  refs/heads/master 2fcef5ecf -> d2607170e


[hotfix] Fix test instability in AbstractTaskManagerProcessFailureRecoveryTest


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

Branch: refs/heads/master
Commit: d2607170e711647373b7cee7cd33dee4bb31466a
Parents: a2cb5df
Author: Stephan Ewen <se...@apache.org>
Authored: Thu Dec 1 18:24:38 2016 +0100
Committer: Stephan Ewen <se...@apache.org>
Committed: Fri Dec 2 12:29:02 2016 +0100

----------------------------------------------------------------------
 ...actTaskManagerProcessFailureRecoveryTest.java | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/d2607170/flink-tests/src/test/java/org/apache/flink/test/recovery/AbstractTaskManagerProcessFailureRecoveryTest.java
----------------------------------------------------------------------
diff --git a/flink-tests/src/test/java/org/apache/flink/test/recovery/AbstractTaskManagerProcessFailureRecoveryTest.java b/flink-tests/src/test/java/org/apache/flink/test/recovery/AbstractTaskManagerProcessFailureRecoveryTest.java
index 3acf5bb..942b212 100644
--- a/flink-tests/src/test/java/org/apache/flink/test/recovery/AbstractTaskManagerProcessFailureRecoveryTest.java
+++ b/flink-tests/src/test/java/org/apache/flink/test/recovery/AbstractTaskManagerProcessFailureRecoveryTest.java
@@ -75,6 +75,8 @@ import static org.junit.Assert.fail;
  */
 public abstract class AbstractTaskManagerProcessFailureRecoveryTest extends TestLogger {
 
+	protected final Logger LOG = LoggerFactory.getLogger(getClass());
+
 	protected static final String READY_MARKER_FILE_PREFIX = "ready_";
 	protected static final String PROCEED_MARKER_FILE = "proceed";
 	protected static final String FINISH_MARKER_FILE_PREFIX = "finish_";
@@ -276,12 +278,13 @@ public abstract class AbstractTaskManagerProcessFailureRecoveryTest extends Test
 	protected void waitUntilNumTaskManagersAreRegistered(ActorRef jobManager, int numExpected, long maxDelayMillis)
 			throws Exception
 	{
-		final long interval = maxDelayMillis * 1_000_000;
-		final long deadline = System.nanoTime() + interval;
-		long remaining = interval;
+		final long pollInterval = 10_000_000; // 10 ms = 10,000,000 nanos
+		final long deadline = System.nanoTime() + maxDelayMillis * 1_000_000;
+
+		long time;
 
-		while (remaining > 0) {
-			FiniteDuration timeout = new FiniteDuration(remaining, TimeUnit.NANOSECONDS);
+		while ((time = System.nanoTime()) < deadline) {
+			FiniteDuration timeout = new FiniteDuration(pollInterval, TimeUnit.NANOSECONDS);
 
 			try {
 				Future<?> result = Patterns.ask(jobManager,
@@ -301,7 +304,11 @@ public abstract class AbstractTaskManagerProcessFailureRecoveryTest extends Test
 				fail("Wrong response: " + e.getMessage());
 			}
 
-			remaining = deadline - System.nanoTime();
+			long timePassed = System.nanoTime() - time;
+			long remainingMillis = (pollInterval - timePassed) / 1_000_000;
+			if (remainingMillis > 0) {
+				Thread.sleep(remainingMillis);
+			}
 		}
 
 		fail("The TaskManagers did not register within the expected time (" + maxDelayMillis + "msecs)");


[2/2] flink git commit: [hotfix] IOUtils.closeQuietly() closes absolutely quietly.

Posted by se...@apache.org.
[hotfix] IOUtils.closeQuietly() closes absolutely quietly.


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

Branch: refs/heads/master
Commit: a2cb5df22c105868bbdbd435e8fed56e8bf02a23
Parents: 2fcef5e
Author: Stephan Ewen <se...@apache.org>
Authored: Thu Dec 1 17:05:47 2016 +0100
Committer: Stephan Ewen <se...@apache.org>
Committed: Fri Dec 2 12:29:02 2016 +0100

----------------------------------------------------------------------
 flink-core/src/main/java/org/apache/flink/util/IOUtils.java | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/a2cb5df2/flink-core/src/main/java/org/apache/flink/util/IOUtils.java
----------------------------------------------------------------------
diff --git a/flink-core/src/main/java/org/apache/flink/util/IOUtils.java b/flink-core/src/main/java/org/apache/flink/util/IOUtils.java
index 9810271..11c06a8 100644
--- a/flink-core/src/main/java/org/apache/flink/util/IOUtils.java
+++ b/flink-core/src/main/java/org/apache/flink/util/IOUtils.java
@@ -215,14 +215,15 @@ public final class IOUtils {
 		}
 	}
 
+	/**
+	 * <p><b>Important:</b> This method is expected to never throw an exception.
+	 */
 	public static void closeQuietly(Closeable closeable) {
 		try {
 			if (closeable != null) {
 				closeable.close();
 			}
-		} catch (IOException ignored) {
-
-		}
+		} catch (Throwable ignored) {}
 	}
 	
 	// ------------------------------------------------------------------------