From d1828d94435eca21761b0ba8458f9de2f125d012 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. --- 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 525e08a8d2..3831722659 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -417,6 +417,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 e2ecf9a83d..d8e7ef6f20 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.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.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 @@ private static TimelineEntity createContainerEntity( } 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() +