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

Optimize AuthorizationPreEventListener to reuse TableWrapper objects

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Authorization
    • Labels:
      None

      Description

      Here's the PartitionWrapper class in AuthorizationPreEventListener:

      AuthorizationPreEventListener.java
       public static class PartitionWrapper extends org.apache.hadoop.hive.ql.metadata.Partition {
      ...
          public PartitionWrapper(org.apache.hadoop.hive.metastore.api.Partition mapiPart, PreEventContext context) throws ... {
       Partition wrapperApiPart   = mapiPart.deepCopy();
       Table t = context.getHandler().get_table_core(
                   mapiPart.getDbName(), 
                   mapiPart.getTableName());
      ...
      }
      

      PreAddPartitionEvent (and soon, PreDropPartitionEvent) correspond not just to a single partition, but an entire set of partitions added atomically. When the event is authorized, HMSHandler.get_table_core() will be called once for every partition in the Event instance.

      Since we already make the assumption that the partition-sets correspond to a single table, we might as well make a single call.

      I'll have a patch for this, shortly.

        Attachments

        1. HIVE-10250.1.patch
          2 kB
          Mithun Radhakrishnan

          Issue Links

            Activity

              People

              • Assignee:
                mithun Mithun Radhakrishnan
                Reporter:
                mithun Mithun Radhakrishnan
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated: