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

Peter Vary commented on HIVE-15184:
-----------------------------------

Thanks [~sbeeram] for taking a look at this! I thought nobody will be 
interested about this patch :)

The {{TokenStoreDelegationTokenSecretManager}} extends 
{{DelegationTokenSecretManager}} which in turn extends 
{{AbstractDelegationTokenSecretManager}}. There is a cache for the 
currentTokens in {{AbstractDelegationTokenSecretManager}} which we are actively 
using in TokenStoreDelegationTokenSecretManager.

{code:title="AbstractDelegationTokenSecretManager"}
  /** 
   * Cache of currently valid tokens, mapping from DelegationTokenIdentifier 
   * to DelegationTokenInformation. Protected by this object lock.
   */
  protected final Map<TokenIdent, DelegationTokenInformation> currentTokens 
      = new HashMap<TokenIdent, DelegationTokenInformation>();
{code}

{code:title=TokenStoreDelegationTokenSecretManager}
  protected void rollMasterKeyExt() throws IOException {
    Map<Integer, DelegationKey> keys = reloadKeys();
    int currentKeyId = super.currentId;
    
HiveDelegationTokenSupport.rollMasterKey(TokenStoreDelegationTokenSecretManager.this);
    List<DelegationKey> keysAfterRoll = Arrays.asList(getAllKeys());
[..]
  }
{code}
Reading the code above, I think the memory leak would be a concern 
independently of the actual TokenStore implementation, what do you think?

About the documentation of the exit, here it is what we do:
- Print out the original exception
- Print out that we think the exception is unrecoverable
- Call {{Runtime.getRuntime().exit(-1)}}
What kind of documentation is in your mind? More comments in the code? Better 
error message? Anything else?

About the way of exit, yeah, it is a little drastic way of exiting the 
metastore. To be honest I only replicated the solution which was used before 
https://github.com/apache/hive/blob/40a12d5535d4b81d297b3529bec7f35bf713b251/shims/common/src/main/java/org/apache/hadoop/hive/thrift/TokenStoreDelegationTokenSecretManager.java#L333
I am open for any suggestions :)

Thanks again for the review,
Peter 


> Add the possibility to separate recoverable and not recoverable errors in 
> DeletagionTokenStore
> ----------------------------------------------------------------------------------------------
>
>                 Key: HIVE-15184
>                 URL: https://issues.apache.org/jira/browse/HIVE-15184
>             Project: Hive
>          Issue Type: Bug
>          Components: HiveServer2, Metastore
>    Affects Versions: 1.3.0, 2.0.1, 2.1.0, 2.2.0
>            Reporter: Peter Vary
>            Assignee: Peter Vary
>         Attachments: HIVE-15184.patch
>
>
> After HIVE-15090 committed we discussed it with [~thejas] and agreed, that it 
> would be even better if the DelegateTokenStore implementation could decide if 
> an error is recoverable or not. Since the DelegationTokenStore is not 
> mentioned as a Hive API it is possible to change the interface, so we could 
> change the implementations shipped with Hive to use the new functionality, 
> and if someone uses it's own implementation of DelegationTokenStore, then he 
> should do the matching changes himself



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to