From 97694e78ad3d90a67ee810eabf85c6df2724ec1f Mon Sep 17 00:00:00 2001 From: Vinod Kumar Vavilapalli Date: Thu, 30 Oct 2014 23:16:19 -0700 Subject: [PATCH] YARN-2779. Fixed ResourceManager to not require delegation tokens for communicating with Timeline Service. Contributed by Zhijie Shen. (cherry picked from commit d1828d94435eca21761b0ba8458f9de2f125d012) --- hadoop-yarn-project/CHANGES.txt | 3 +++ .../metrics/SystemMetricsPublisher.java | 27 ------------------- 2 files changed, 3 insertions(+), 27 deletions(-) diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index 09a0f74d7b6..a78f51e5ce3 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -387,6 +387,9 @@ Release 2.6.0 - UNRELEASED YARN-2503. Added node lablels in web UI. (Wangda Tan via jianhe) + YARN-2779. Fixed ResourceManager to not require delegation tokens for + communicating with Timeline Service. (Zhijie Shen via vinodkv) + OPTIMIZATIONS BUG FIXES diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/metrics/SystemMetricsPublisher.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/metrics/SystemMetricsPublisher.java index e2ecf9a83df..d8e7ef6f202 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/metrics/SystemMetricsPublisher.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/metrics/SystemMetricsPublisher.java @@ -28,8 +28,6 @@ import org.apache.commons.logging.LogFactory; import org.apache.hadoop.classification.InterfaceAudience.Private; import org.apache.hadoop.classification.InterfaceStability.Unstable; import org.apache.hadoop.conf.Configuration; -import org.apache.hadoop.security.UserGroupInformation; -import org.apache.hadoop.security.token.Token; import org.apache.hadoop.service.CompositeService; import org.apache.hadoop.yarn.api.records.ApplicationAttemptId; import org.apache.hadoop.yarn.api.records.ApplicationId; @@ -42,7 +40,6 @@ import org.apache.hadoop.yarn.event.AsyncDispatcher; import org.apache.hadoop.yarn.event.Dispatcher; import org.apache.hadoop.yarn.event.Event; import org.apache.hadoop.yarn.event.EventHandler; -import org.apache.hadoop.yarn.security.client.TimelineDelegationTokenIdentifier; import org.apache.hadoop.yarn.server.metrics.AppAttemptMetricsConstants; import org.apache.hadoop.yarn.server.metrics.ApplicationMetricsConstants; import org.apache.hadoop.yarn.server.metrics.ContainerMetricsConstants; @@ -65,13 +62,10 @@ public class SystemMetricsPublisher extends CompositeService { private static final Log LOG = LogFactory .getLog(SystemMetricsPublisher.class); - private static final int MAX_GET_TIMELINE_DELEGATION_TOKEN_ATTEMPTS = 10; private Dispatcher dispatcher; private TimelineClient client; private boolean publishSystemMetrics; - private int getTimelineDelegtionTokenAttempts = 0; - private boolean hasReceivedTimelineDelegtionToken = false; public SystemMetricsPublisher() { super(SystemMetricsPublisher.class.getName()); @@ -423,27 +417,6 @@ public class SystemMetricsPublisher extends CompositeService { } private void putEntity(TimelineEntity entity) { - if (UserGroupInformation.isSecurityEnabled()) { - if (!hasReceivedTimelineDelegtionToken - && getTimelineDelegtionTokenAttempts < MAX_GET_TIMELINE_DELEGATION_TOKEN_ATTEMPTS) { - try { - Token token = - client.getDelegationToken( - UserGroupInformation.getCurrentUser().getUserName()); - UserGroupInformation.getCurrentUser().addToken(token); - hasReceivedTimelineDelegtionToken = true; - } catch (Exception e) { - LOG.error("Error happens when getting timeline delegation token", e); - } finally { - ++getTimelineDelegtionTokenAttempts; - if (!hasReceivedTimelineDelegtionToken - && getTimelineDelegtionTokenAttempts == MAX_GET_TIMELINE_DELEGATION_TOKEN_ATTEMPTS) { - LOG.error("Run out of the attempts to get timeline delegation token. " + - "Use kerberos authentication only."); - } - } - } - } try { if (LOG.isDebugEnabled()) { LOG.debug("Publishing the entity " + entity.getEntityId() +