You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "Thejas M Nair (JIRA)" <ji...@apache.org> on 2015/03/16 22:58:38 UTC
[jira] [Commented] (HIVE-9981) Avoid throwing many exceptions when
attempting to create new hdfs encryption shim
[ https://issues.apache.org/jira/browse/HIVE-9981?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14364049#comment-14364049 ]
Thejas M Nair commented on HIVE-9981:
-------------------------------------
[~spena] It does not look like this will avoid the exceptions in every call to this function with pre 2.6.0 hadoop versions. getEncryptionZoneForPathMethod will always be null.
Maybe use a Boolean object isHdfsEncryptionSupported instead ? (if null initialize it to true/false).
> Avoid throwing many exceptions when attempting to create new hdfs encryption shim
> ---------------------------------------------------------------------------------
>
> Key: HIVE-9981
> URL: https://issues.apache.org/jira/browse/HIVE-9981
> Project: Hive
> Issue Type: Improvement
> Components: Encryption
> Reporter: Sergio Peña
> Assignee: Sergio Peña
> Attachments: HIVE-9981.1.patch
>
>
> Hadoop23Shims.createHdfsEncryptionShim() is throwing an exception for verions lower than 2.6.0 everytime a query is executed.
> Exceptions are expensive, so rather than throwing them every time, we can use this design pattern followed for some other functions in Hadoop23Shims -
> {code}
> protected static final Method accessMethod;
> protected static final Method getPasswordMethod;
> static {
> Method m = null;
> try {
> m = FileSystem.class.getMethod("access", Path.class, FsAction.class);
> } catch (NoSuchMethodException err) {
> // This version of Hadoop does not support FileSystem.access().
> }
> accessMethod = m;
> try {
> m = Configuration.class.getMethod("getPassword", String.class);
> } catch (NoSuchMethodException err) {
> // This version of Hadoop does not support getPassword(), just retrieve password from conf.
> m = null;
> }
> getPasswordMethod = m;
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)