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

Bikas Saha commented on YARN-582:
---------------------------------

Move into a common function?
{code}
      Credentials credentials = new Credentials();
      Token<ApplicationTokenIdentifier> appToken = 
appAttempt.getApplicationToken();
      if(appToken != null){
        credentials.addToken(appToken.getService(), appToken);
      }
      Token<ClientTokenIdentifier> clientToken = appAttempt.getClientToken();
      if(clientToken != null){
        credentials.addToken(clientToken.getService(), clientToken);
      }

      ApplicationAttemptState attemptState =
          new ApplicationAttemptState(appAttempt.getAppAttemptId(),
            appAttempt.getMasterContainer(), credentials);
{code}

We should not catch and ignore the exception. Lets catch it in existing catch 
block so that attempt gets notified of error.
{code}
            try {
              credentials.writeTokenStorageToStream(dob);
            } catch (IOException e) {
              LOG.warn("Error converting credentials to bytebuffer" +
                        " while storing attempt: " + 
attemptState.getAttemptId());
            }
{code}

Lets add "because running attempts are rebooted"
{code}
      // For now, no need to populate tokens back to
      // ApplicationTokenSecretManager.
{code}

Why not simply create it once in the RMAppAttemptImpl and re-use it like 
earlier?
{code}
          origTrackingUrl = this.currentAttempt.getOriginalTrackingUrl();
          Token<ClientTokenIdentifier> attemptClientToken =
              this.currentAttempt.getClientToken();
          if (attemptClientToken != null) {
            clientToken =
                BuilderUtils.newClientToken(attemptClientToken.getIdentifier(),
                  attemptClientToken.getKind().toString(), attemptClientToken
                    .getPassword(), attemptClientToken.getService().toString());
          }
{code}

                
> Restore appToken for app attempt after RM restart
> -------------------------------------------------
>
>                 Key: YARN-582
>                 URL: https://issues.apache.org/jira/browse/YARN-582
>             Project: Hadoop YARN
>          Issue Type: Sub-task
>          Components: resourcemanager
>            Reporter: Bikas Saha
>            Assignee: Jian He
>         Attachments: YARN-582.1.patch, YARN-582.2.patch, YARN-582.3.patch, 
> YARN-582.4.patch, YARN-582.5.patch
>
>
> These need to be saved and restored on a per app attempt basis. This is 
> required only when work preserving restart is implemented for secure 
> clusters. In non-preserving restart app attempts are killed and so this does 
> not matter.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to