Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-9981

Avoid throwing many exceptions when attempting to create new hdfs encryption shim

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.2.0
    • Encryption
    • None

    Description

      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 -

        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;
        }
      

      Attachments

        1. HIVE-9981.1.patch
          2 kB
          Sergio Peña
        2. HIVE-9981.2.patch
          2 kB
          Sergio Peña

        Issue Links

          Activity

            People

              spena Sergio Peña
              spena Sergio Peña
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: