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

Vihang Karajgaonkar edited comment on HIVE-17371 at 10/6/17 2:15 AM:
---------------------------------------------------------------------

Attaching second version of the patch which moves {{DelegationTokenManager}} 
and associated classes to standalone metastore module as per [~thejas]'s 
suggestion. I had to copy a few utils methods which were being used in both 
HS2, HiveConnection and Metastore into separate Util classes for HS2 and HMS. I 
also abandoned the idea of making HMS work with 
{{AbstractDelegationTokenIdentifier}} since the code change was getting bigger 
and more complex. Since as of now I don't see any other application making 
using of DelegationTokenStores other than Hive itself, I think this is fine. 
With this patch all the DelegationToken related logic will be moved to 
standalone metastore instead of keeping a duplicate copy of each class in both 
HS2 and HMS.

Also, removed HadoopAuthThrift class from shims since it was not needed 
anymore. HS2 can reuse the one already present in metastore module. This is 
needed otherwise we will have a dependency on metastore module for the shims 
module.

Updated the review board as well.


was (Author: vihangk1):
Attaching second version of the patch which moves {{DelegationTokenManager}} 
and associated classes to standalone metastore module as per [~thejas]'s 
suggestion. I had to copy a few utils methods which were being used in both 
HS2, HiveConnection and Metastore into separate Util classes for HS2 and HMS. I 
also abandoned the idea of making HMS work with 
{{AbstractDelegationTokenIdentifier}} since the code change was getting bigger 
and more complex. Since as of now I don't see any other application making 
using of DelegationTokenStores other than Hive itself, I think this is fine. 
With this patch all the DelegationToken related logic will be moved to 
standalone metastore instead of keeping a duplicate copy of each class in both 
HS2 and HMS.

> Move tokenstores to metastore module
> ------------------------------------
>
>                 Key: HIVE-17371
>                 URL: https://issues.apache.org/jira/browse/HIVE-17371
>             Project: Hive
>          Issue Type: Sub-task
>          Components: Metastore
>            Reporter: Vihang Karajgaonkar
>            Assignee: Vihang Karajgaonkar
>         Attachments: HIVE-17371.01.patch, HIVE-17371.02.patch
>
>
> The {{getTokenStore}} method will not work for the {{DBTokenStore}} and 
> {{ZKTokenStore}} since they implement 
> {{org.apache.hadoop.hive.thrift.DelegationTokenStore}} instead of  
> {{org.apache.hadoop.hive.metastore.security.DelegationTokenStore}}
> {code}
> private DelegationTokenStore getTokenStore(Configuration conf) throws 
> IOException {
>     String tokenStoreClassName =
>         MetastoreConf.getVar(conf, 
> MetastoreConf.ConfVars.DELEGATION_TOKEN_STORE_CLS, "");
>     // The second half of this if is to catch cases where users are passing 
> in a HiveConf for
>     // configuration.  It will have set the default value of
>     // "hive.cluster.delegation.token.store .class" to
>     // "org.apache.hadoop.hive.thrift.MemoryTokenStore" as part of its 
> construction.  But this is
>     // the hive-shims version of the memory store.  We want to convert this 
> to our default value.
>     if (StringUtils.isBlank(tokenStoreClassName) ||
>         
> "org.apache.hadoop.hive.thrift.MemoryTokenStore".equals(tokenStoreClassName)) 
> {
>       return new MemoryTokenStore();
>     }
>     try {
>       Class<? extends DelegationTokenStore> storeClass =
>           
> Class.forName(tokenStoreClassName).asSubclass(DelegationTokenStore.class);
>       return ReflectionUtils.newInstance(storeClass, conf);
>     } catch (ClassNotFoundException e) {
>       throw new IOException("Error initializing delegation token store: " + 
> tokenStoreClassName, e);
>     }
>   }
> {code}



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

Reply via email to