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 2014/09/23 19:27:58 UTC

git commit: (TWILL-101) Schedule HDFS delegation token update before it expires.

Repository: incubator-twill
Updated Branches:
  refs/heads/master 8cf4cd02c -> 7a72ce18e


(TWILL-101) Schedule HDFS delegation token update before it expires.

Signed-off-by: Terence Yim <te...@continuuity.com>


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

Branch: refs/heads/master
Commit: 7a72ce18e37d94d5baf0237e24b7aaeb8ca7647f
Parents: 8cf4cd0
Author: Terence Yim <te...@continuuity.com>
Authored: Tue Sep 23 01:58:22 2014 -0700
Committer: Terence Yim <te...@continuuity.com>
Committed: Tue Sep 23 02:21:58 2014 -0700

----------------------------------------------------------------------
 .../org/apache/twill/yarn/YarnTwillRunnerService.java     | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-twill/blob/7a72ce18/twill-yarn/src/main/java/org/apache/twill/yarn/YarnTwillRunnerService.java
----------------------------------------------------------------------
diff --git a/twill-yarn/src/main/java/org/apache/twill/yarn/YarnTwillRunnerService.java b/twill-yarn/src/main/java/org/apache/twill/yarn/YarnTwillRunnerService.java
index 4c16cc1..2634e78 100644
--- a/twill-yarn/src/main/java/org/apache/twill/yarn/YarnTwillRunnerService.java
+++ b/twill-yarn/src/main/java/org/apache/twill/yarn/YarnTwillRunnerService.java
@@ -309,8 +309,14 @@ public final class YarnTwillRunnerService extends AbstractIdleService implements
 
     // Schedule an updater for updating HDFS delegation tokens
     if (UserGroupInformation.isSecurityEnabled()) {
-      long delay = yarnConfig.getLong(DFSConfigKeys.DFS_NAMENODE_DELEGATION_TOKEN_RENEW_INTERVAL_KEY,
-                                      DFSConfigKeys.DFS_NAMENODE_DELEGATION_TOKEN_RENEW_INTERVAL_DEFAULT);
+      long renewalInterval = yarnConfig.getLong(DFSConfigKeys.DFS_NAMENODE_DELEGATION_TOKEN_RENEW_INTERVAL_KEY,
+                                                DFSConfigKeys.DFS_NAMENODE_DELEGATION_TOKEN_RENEW_INTERVAL_DEFAULT);
+      // Schedule it five minutes before it expires.
+      long delay = renewalInterval - TimeUnit.MINUTES.toMillis(5);
+      // Just to safeguard. In practice, the value shouldn't be that small, otherwise nothing could work.
+      if (delay <= 0) {
+        delay = (renewalInterval <= 2) ? 1 : renewalInterval / 2;
+      }
       scheduleSecureStoreUpdate(new LocationSecureStoreUpdater(yarnConfig, locationFactory),
                                 delay, delay, TimeUnit.MILLISECONDS);
     }