You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@twill.apache.org by ch...@apache.org on 2018/03/19 05:59:20 UTC

[1/3] twill git commit: Trying to use loopback address for ZK server

Repository: twill
Updated Branches:
  refs/heads/feature/zk-localhost [created] 01f8123c9


Trying to use loopback address for ZK server

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

Branch: refs/heads/feature/zk-localhost
Commit: 88137f7b28d2ab1d9e201a9dbd8edaf7461f61fe
Parents: 8f70aa4
Author: Terence Yim <ch...@apache.org>
Authored: Sun Mar 18 15:54:03 2018 -0700
Committer: Terence Yim <ch...@apache.org>
Committed: Sun Mar 18 22:22:37 2018 -0700

----------------------------------------------------------------------
 .../internal/zookeeper/InMemoryZKServer.java      | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/twill/blob/88137f7b/twill-zookeeper/src/main/java/org/apache/twill/internal/zookeeper/InMemoryZKServer.java
----------------------------------------------------------------------
diff --git a/twill-zookeeper/src/main/java/org/apache/twill/internal/zookeeper/InMemoryZKServer.java b/twill-zookeeper/src/main/java/org/apache/twill/internal/zookeeper/InMemoryZKServer.java
index f962b68..ce46808 100644
--- a/twill-zookeeper/src/main/java/org/apache/twill/internal/zookeeper/InMemoryZKServer.java
+++ b/twill-zookeeper/src/main/java/org/apache/twill/internal/zookeeper/InMemoryZKServer.java
@@ -103,18 +103,18 @@ public final class InMemoryZKServer implements Service {
   }
 
   private InetSocketAddress getAddress(int port) {
-    try {
+//    try {
       int socketPort = port < 0 ? 0 : port;
       // This property is needed so that in certain CI environment (e.g. Travis-CI) it can only works properly if
       // it is binded to the wildcard (0.0.0.0) address
-      if (Boolean.parseBoolean(System.getProperties().getProperty("twill.zk.server.localhost", "true"))) {
-        return new InetSocketAddress(InetAddress.getLocalHost(), socketPort);
-      } else {
-        return new InetSocketAddress(socketPort);
-      }
-    } catch (UnknownHostException e) {
-      throw Throwables.propagate(e);
-    }
+//      if (Boolean.parseBoolean(System.getProperties().getProperty("twill.zk.server.localhost", "true"))) {
+        return new InetSocketAddress(InetAddress.getLoopbackAddress(), socketPort);
+//      } else {
+//        return new InetSocketAddress(socketPort);
+//      }
+//    } catch (UnknownHostException e) {
+//      throw Throwables.propagate(e);
+//    }
   }
 
   private void cleanDir(File dir) {


[3/3] twill git commit: Added logs for debugging.

Posted by ch...@apache.org.
Added logs for debugging.

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

Branch: refs/heads/feature/zk-localhost
Commit: 01f8123c93b47509845b4cc4d4d2fb3dcf093d68
Parents: f3025f5
Author: Terence Yim <ch...@apache.org>
Authored: Sun Mar 18 22:59:14 2018 -0700
Committer: Terence Yim <ch...@apache.org>
Committed: Sun Mar 18 22:59:14 2018 -0700

----------------------------------------------------------------------
 .../main/java/org/apache/twill/yarn/LocationCacheCleaner.java   | 5 ++++-
 .../src/test/java/org/apache/twill/yarn/LocationCacheTest.java  | 3 ++-
 2 files changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/twill/blob/01f8123c/twill-yarn/src/main/java/org/apache/twill/yarn/LocationCacheCleaner.java
----------------------------------------------------------------------
diff --git a/twill-yarn/src/main/java/org/apache/twill/yarn/LocationCacheCleaner.java b/twill-yarn/src/main/java/org/apache/twill/yarn/LocationCacheCleaner.java
index 0738218..870823f 100644
--- a/twill-yarn/src/main/java/org/apache/twill/yarn/LocationCacheCleaner.java
+++ b/twill-yarn/src/main/java/org/apache/twill/yarn/LocationCacheCleaner.java
@@ -113,6 +113,7 @@ final class LocationCacheCleaner extends AbstractIdleService {
 
       // If rejected by the predicate, it means it is being used, hence remove it from the pending cleanup list.
       if (!cleanupPredicate.apply(pendingCleanup.getLocation())) {
+        LOG.debug("Rejected deletion of location {}", pendingCleanup.getLocation());
         iterator.remove();
       } else {
         try {
@@ -144,7 +145,9 @@ final class LocationCacheCleaner extends AbstractIdleService {
               }
               // If the location is already pending for cleanup, this won't update the expire time as
               // the comparison of PendingCleanup is only by location.
-              pendingCleanups.add(new PendingCleanup(location, expireTime));
+              if (pendingCleanups.add(new PendingCleanup(location, expireTime))) {
+                LOG.debug("Pending deletion of location {} with expiration time at {}", location, expireTime);
+              }
             }
           }
         } catch (IOException e) {

http://git-wip-us.apache.org/repos/asf/twill/blob/01f8123c/twill-yarn/src/test/java/org/apache/twill/yarn/LocationCacheTest.java
----------------------------------------------------------------------
diff --git a/twill-yarn/src/test/java/org/apache/twill/yarn/LocationCacheTest.java b/twill-yarn/src/test/java/org/apache/twill/yarn/LocationCacheTest.java
index 8ed9ae4..f7c9e27 100644
--- a/twill-yarn/src/test/java/org/apache/twill/yarn/LocationCacheTest.java
+++ b/twill-yarn/src/test/java/org/apache/twill/yarn/LocationCacheTest.java
@@ -114,7 +114,8 @@ public class LocationCacheTest {
       .forceLocationCacheCleanup(System.currentTimeMillis() + Configs.Defaults.LOCATION_CACHE_ANTIQUE_EXPIRY_MS);
 
     // Now there shouldn't be any file under the current session cache directory
-    Assert.assertTrue(currentSessionCache.list().isEmpty());
+    List<Location> locations = currentSessionCache.list();
+    Assert.assertTrue("Location is not empty " + locations, locations.isEmpty());
   }
 
   /**


[2/3] twill git commit: Updates

Posted by ch...@apache.org.
Updates

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

Branch: refs/heads/feature/zk-localhost
Commit: f3025f5e3bd8cf195bc94ef799deb79f6419ccf9
Parents: 88137f7
Author: Terence Yim <ch...@apache.org>
Authored: Sun Mar 18 21:03:49 2018 -0700
Committer: Terence Yim <ch...@apache.org>
Committed: Sun Mar 18 22:22:54 2018 -0700

----------------------------------------------------------------------
 .travis.yml                                     |  2 +-
 .../twill/yarn/LogLevelChangeTestRun.java       | 22 ++++++++++----------
 .../internal/zookeeper/InMemoryZKServer.java    | 15 +------------
 3 files changed, 13 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/twill/blob/f3025f5e/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index 55101b7..af74548 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -31,7 +31,7 @@ branches:
     - /^branch\-.*$/
     - /^feature\/.*$/
 
-script: mvn --batch-mode test -P $PROFILE -Dsurefire.redirectTestOutputToFile=false -Dtwill.zk.server.localhost=false
+script: mvn --batch-mode test -P $PROFILE -Dsurefire.redirectTestOutputToFile=false
 
 install: mvn --batch-mode install -P $PROFILE -DskipTests=true
 

http://git-wip-us.apache.org/repos/asf/twill/blob/f3025f5e/twill-yarn/src/test/java/org/apache/twill/yarn/LogLevelChangeTestRun.java
----------------------------------------------------------------------
diff --git a/twill-yarn/src/test/java/org/apache/twill/yarn/LogLevelChangeTestRun.java b/twill-yarn/src/test/java/org/apache/twill/yarn/LogLevelChangeTestRun.java
index 6df6d11..099b68f 100644
--- a/twill-yarn/src/test/java/org/apache/twill/yarn/LogLevelChangeTestRun.java
+++ b/twill-yarn/src/test/java/org/apache/twill/yarn/LogLevelChangeTestRun.java
@@ -172,20 +172,20 @@ public class LogLevelChangeTestRun extends BaseYarnTest {
 
     // assert that log level is DEBUG
     waitForLogLevel(controller, LogLevelTestRunnable.class.getSimpleName(),
-                    20L, TimeUnit.SECONDS, LogEntry.Level.DEBUG, ImmutableMap.of("ROOT", LogEntry.Level.DEBUG));
+                    60L, TimeUnit.SECONDS, LogEntry.Level.DEBUG, ImmutableMap.of("ROOT", LogEntry.Level.DEBUG));
 
     waitForLogLevel(controller, LogLevelTestSecondRunnable.class.getSimpleName(),
-                    20L, TimeUnit.SECONDS, LogEntry.Level.DEBUG, ImmutableMap.of("ROOT", LogEntry.Level.DEBUG));
+                    60L, TimeUnit.SECONDS, LogEntry.Level.DEBUG, ImmutableMap.of("ROOT", LogEntry.Level.DEBUG));
 
     // change the log level to INFO
     controller.updateLogLevels(ImmutableMap.of(Logger.ROOT_LOGGER_NAME, LogEntry.Level.INFO)).get();
 
     // assert log level has changed to INFO
     waitForLogLevel(controller, LogLevelTestRunnable.class.getSimpleName(),
-                    20L, TimeUnit.SECONDS, LogEntry.Level.INFO, ImmutableMap.of("ROOT", LogEntry.Level.INFO));
+                    60L, TimeUnit.SECONDS, LogEntry.Level.INFO, ImmutableMap.of("ROOT", LogEntry.Level.INFO));
 
     waitForLogLevel(controller, LogLevelTestSecondRunnable.class.getSimpleName(),
-                    20L, TimeUnit.SECONDS, LogEntry.Level.INFO, ImmutableMap.of("ROOT", LogEntry.Level.INFO));
+                    60L, TimeUnit.SECONDS, LogEntry.Level.INFO, ImmutableMap.of("ROOT", LogEntry.Level.INFO));
 
     // change the log level of LogLevelTestRunnable to WARN,
     // change the log level of LogLevelTestSecondRunnable to TRACE
@@ -195,15 +195,15 @@ public class LogLevelChangeTestRun extends BaseYarnTest {
     controller.updateLogLevels(LogLevelTestSecondRunnable.class.getSimpleName(), logLevelSecondRunnable).get();
 
     waitForLogLevel(controller, LogLevelTestRunnable.class.getSimpleName(),
-                    20L, TimeUnit.SECONDS, LogEntry.Level.WARN, ImmutableMap.of("ROOT", LogEntry.Level.WARN));
+                    60L, TimeUnit.SECONDS, LogEntry.Level.WARN, ImmutableMap.of("ROOT", LogEntry.Level.WARN));
     waitForLogLevel(controller, LogLevelTestSecondRunnable.class.getSimpleName(),
-                    20L, TimeUnit.SECONDS, LogEntry.Level.TRACE, ImmutableMap.of("ROOT", LogEntry.Level.TRACE));
+                    60L, TimeUnit.SECONDS, LogEntry.Level.TRACE, ImmutableMap.of("ROOT", LogEntry.Level.TRACE));
 
     // change a particular logger to log level warn and reset it back.
     logLevelFirstRunnable = ImmutableMap.of("test", LogEntry.Level.WARN);
     controller.updateLogLevels(LogLevelTestRunnable.class.getSimpleName(), logLevelFirstRunnable).get();
     waitForLogLevel(controller, LogLevelTestRunnable.class.getSimpleName(),
-                    20L, TimeUnit.SECONDS, LogEntry.Level.WARN,
+                    60L, TimeUnit.SECONDS, LogEntry.Level.WARN,
                     ImmutableMap.of("ROOT", LogEntry.Level.WARN, "test", LogEntry.Level.WARN));
     logLevelFirstRunnable = new HashMap<>();
     logLevelFirstRunnable.put("test", null);
@@ -212,13 +212,13 @@ public class LogLevelChangeTestRun extends BaseYarnTest {
     result.put("ROOT", LogEntry.Level.WARN);
     result.put("test", null);
     waitForLogLevel(controller, LogLevelTestRunnable.class.getSimpleName(),
-                    20L, TimeUnit.SECONDS, LogEntry.Level.WARN, result);
+                    60L, TimeUnit.SECONDS, LogEntry.Level.WARN, result);
 
     // reset the log level for a particular logger of LogLevelTestRunnable
     controller.resetRunnableLogLevels(LogLevelTestRunnable.class.getSimpleName(), "test").get();
     result.remove("test");
     waitForLogLevel(controller, LogLevelTestRunnable.class.getSimpleName(),
-                    20L, TimeUnit.SECONDS, LogEntry.Level.WARN, result);
+                    60L, TimeUnit.SECONDS, LogEntry.Level.WARN, result);
 
     // change the log level of LogLevelTestSecondRunnable to INFO and change instances of it to test if the log level
     // request get applied to container started up later
@@ -233,9 +233,9 @@ public class LogLevelChangeTestRun extends BaseYarnTest {
     // reset the log levels back to default.
     controller.resetLogLevels().get();
     waitForLogLevel(controller, LogLevelTestRunnable.class.getSimpleName(),
-                    20L, TimeUnit.SECONDS, LogEntry.Level.DEBUG, ImmutableMap.of("ROOT", LogEntry.Level.DEBUG));
+                    60L, TimeUnit.SECONDS, LogEntry.Level.DEBUG, ImmutableMap.of("ROOT", LogEntry.Level.DEBUG));
     waitForLogLevel(controller, LogLevelTestSecondRunnable.class.getSimpleName(),
-                    20L, TimeUnit.SECONDS, LogEntry.Level.DEBUG, ImmutableMap.of("ROOT", LogEntry.Level.DEBUG));
+                    60L, TimeUnit.SECONDS, LogEntry.Level.DEBUG, ImmutableMap.of("ROOT", LogEntry.Level.DEBUG));
 
     // stop
     controller.terminate().get(120, TimeUnit.SECONDS);

http://git-wip-us.apache.org/repos/asf/twill/blob/f3025f5e/twill-zookeeper/src/main/java/org/apache/twill/internal/zookeeper/InMemoryZKServer.java
----------------------------------------------------------------------
diff --git a/twill-zookeeper/src/main/java/org/apache/twill/internal/zookeeper/InMemoryZKServer.java b/twill-zookeeper/src/main/java/org/apache/twill/internal/zookeeper/InMemoryZKServer.java
index ce46808..7ffed8c 100644
--- a/twill-zookeeper/src/main/java/org/apache/twill/internal/zookeeper/InMemoryZKServer.java
+++ b/twill-zookeeper/src/main/java/org/apache/twill/internal/zookeeper/InMemoryZKServer.java
@@ -18,7 +18,6 @@
 package org.apache.twill.internal.zookeeper;
 
 import com.google.common.base.Preconditions;
-import com.google.common.base.Throwables;
 import com.google.common.io.Files;
 import com.google.common.util.concurrent.AbstractIdleService;
 import com.google.common.util.concurrent.ListenableFuture;
@@ -32,7 +31,6 @@ import org.slf4j.LoggerFactory;
 import java.io.File;
 import java.net.InetAddress;
 import java.net.InetSocketAddress;
-import java.net.UnknownHostException;
 import java.util.concurrent.Executor;
 
 /**
@@ -103,18 +101,7 @@ public final class InMemoryZKServer implements Service {
   }
 
   private InetSocketAddress getAddress(int port) {
-//    try {
-      int socketPort = port < 0 ? 0 : port;
-      // This property is needed so that in certain CI environment (e.g. Travis-CI) it can only works properly if
-      // it is binded to the wildcard (0.0.0.0) address
-//      if (Boolean.parseBoolean(System.getProperties().getProperty("twill.zk.server.localhost", "true"))) {
-        return new InetSocketAddress(InetAddress.getLoopbackAddress(), socketPort);
-//      } else {
-//        return new InetSocketAddress(socketPort);
-//      }
-//    } catch (UnknownHostException e) {
-//      throw Throwables.propagate(e);
-//    }
+    return new InetSocketAddress(InetAddress.getLoopbackAddress(), port < 0 ? 0 : port);
   }
 
   private void cleanDir(File dir) {