[ 
https://issues.apache.org/jira/browse/MAPREDUCE-6838?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16134221#comment-16134221
 ] 

Rohith Sharma K S commented on MAPREDUCE-6838:
----------------------------------------------

thanks Varun for updating patch! Overall approach looks reasonable to me.
Some comments on _setTimelineCollectorInfo_ method. Can it be simplified? 
# Need to log a WARN message if collector info is null.
# In CollectorInfo object, If collector address is null and Token is non-null. 
Do not add that token into ugi.
# it means definitely something wrong in input. .
# currentTimelineToken should be volatile
# 
{{!delegationToken.getKind().equals(TimelineDelegationTokenIdentifier.KIND_NAME.toString())}}
 check is not required since equals does this comparrission too.
# Creating Token does not required to check service==null. Internally 
constructor does. And we can ignore token service passed by delegationToken 
always and set it up collector address. 
# can this method modified as below?
{code}
public void setTimelineCollectorInfo(CollectorInfo collectorInfo) {
    if (collectorInfo == null || collectorInfo.getCollectorAddr()== null) {
      LOG.warn(""); // warning message
      return;
    }

    if (collectorInfo.getCollectorToken() != null) {
      setTimelineDelegationToken(collectorInfo.getCollectorToken(),
          collectorInfo.getCollectorAddr());
    }

    this.timelineServiceAddress = collectorInfo.getCollectorAddr();
    LOG.info("Updated timeline service address to " + timelineServiceAddress);
  }

  private void setTimelineDelegationToken(Token delegationToken,
      String collectorAddr) {
    if (currentTimelineToken != null
        && currentTimelineToken.equals(delegationToken)) {
      return;
    }
    currentTimelineToken = delegationToken;
    org.apache.hadoop.security.token.Token<TimelineDelegationTokenIdentifier> 
timelineToken =
        new 
org.apache.hadoop.security.token.Token<TimelineDelegationTokenIdentifier>(
            delegationToken.getIdentifier().array(),
            delegationToken.getPassword().array(),
            new Text(delegationToken.getKind()),
            null);
    InetSocketAddress serviceAddr = NetUtils.createSocketAddr(collectorAddr);
    SecurityUtil.setTokenService(timelineToken, serviceAddr);
    authUgi.addToken(timelineToken);
    LOG.info("Updated timeline delegation token " + timelineToken);
  }
{code}

> [ATSv2 Security] Add timeline delegation token received in allocate response 
> to UGI
> -----------------------------------------------------------------------------------
>
>                 Key: MAPREDUCE-6838
>                 URL: https://issues.apache.org/jira/browse/MAPREDUCE-6838
>             Project: Hadoop Map/Reduce
>          Issue Type: Sub-task
>            Reporter: Varun Saxena
>            Assignee: Varun Saxena
>              Labels: yarn-5355-merge-blocker
>             Fix For: YARN-5355
>
>         Attachments: MAPREDUCE-6838-YARN-5355.01.patch, 
> MAPREDUCE-6838-YARN-5355.02.patch, MAPREDUCE-6838-YARN-5355.03.patch, 
> MAPREDUCE-6838-YARN-5355.04.patch, MAPREDUCE-6838-YARN-5355.05.patch
>
>




--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to