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

Jian He commented on YARN-2208:
-------------------------------

In which case this if condition can happen?
{code}
    if (this.currentMasterKey == null && this.nextMasterKey == null) {
      this.currentMasterKey = createNewMasterKey();
    }
{code}

 merge the duplicate code
{code}
    else if (identifier.getKeyId() == this.currentMasterKey.getMasterKey()
      .getKeyId()) {
      LOG.info("AMRMToken password retrieved successfully!!");
      byte[] password = retrivePasswordInternal(identifier, currentMasterKey);
      PasswordInfo pwd = new PasswordInfo(password, identifier.getKeyId());
      passwords.put(applicationAttemptId, pwd);
      return password;
    } else if (nextMasterKey != null
        && identifier.getKeyId() == this.nextMasterKey.getMasterKey()
          .getKeyId()) {
      LOG.info("AMRMToken password retrieved successfully!!");
      byte[] password = retrivePasswordInternal(identifier, nextMasterKey);
      PasswordInfo pwd = new PasswordInfo(password, identifier.getKeyId());
      passwords.put(applicationAttemptId, pwd);
      return password;
    }
{code}
 test case: original testMasterKeyRollOver is not enough, it calls 
rollMasterKey to roll master key. But after this patch, the new master key will 
be activated only after activation delay. we need to test 1) the original token 
is still valid after key rolled over but before activated, and 2) invalid after 
the new master key is activated. 3) new token can be generated off the new 
master instead of old master key.

> AMRMTokenManager need to have a way to roll over AMRMToken
> ----------------------------------------------------------
>
>                 Key: YARN-2208
>                 URL: https://issues.apache.org/jira/browse/YARN-2208
>             Project: Hadoop YARN
>          Issue Type: Sub-task
>          Components: resourcemanager
>            Reporter: Xuan Gong
>            Assignee: Xuan Gong
>         Attachments: YARN-2208.1.patch, YARN-2208.2.patch, YARN-2208.3.patch, 
> YARN-2208.4.patch
>
>




--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to