You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by ng...@apache.org on 2020/08/10 15:59:36 UTC

[hive] branch master updated: HIVE-24004: Improve performance for filter hook for superuser path(Sam An, reviewed by Naveen Gangam)

This is an automated email from the ASF dual-hosted git repository.

ngangam pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hive.git


The following commit(s) were added to refs/heads/master by this push:
     new 9fc8da6  HIVE-24004: Improve performance for filter hook for superuser path(Sam An, reviewed by Naveen Gangam)
9fc8da6 is described below

commit 9fc8da6f32b68006c222ccfd038719fc89ff8550
Author: Sam An <sa...@cloudera.com>
AuthorDate: Thu Aug 6 18:06:06 2020 -0700

    HIVE-24004: Improve performance for filter hook for superuser path(Sam An, reviewed by Naveen Gangam)
---
 .../plugin/metastore/HiveMetaStoreAuthorizer.java           | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/ql/src/java/org/apache/hadoop/hive/ql/security/authorization/plugin/metastore/HiveMetaStoreAuthorizer.java b/ql/src/java/org/apache/hadoop/hive/ql/security/authorization/plugin/metastore/HiveMetaStoreAuthorizer.java
index 09d5946..fb9d6dd 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/security/authorization/plugin/metastore/HiveMetaStoreAuthorizer.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/security/authorization/plugin/metastore/HiveMetaStoreAuthorizer.java
@@ -96,9 +96,10 @@ public class HiveMetaStoreAuthorizer extends MetaStorePreEventListener implement
     LOG.debug("==> HiveMetaStoreAuthorizer.onEvent(): EventType=" + preEventContext.getEventType());
 
     try {
-      HiveAuthorizer hiveAuthorizer = createHiveMetaStoreAuthorizer();
-      if (!skipAuthorization()) {
-        HiveMetaStoreAuthzInfo authzContext = buildAuthzContext(preEventContext);
+      HiveMetaStoreAuthzInfo authzContext = buildAuthzContext(preEventContext);
+
+      if (!skipAuthorization(authzContext)) {
+        HiveAuthorizer hiveAuthorizer = createHiveMetaStoreAuthorizer();
         checkPrivileges(authzContext, hiveAuthorizer);
       }
     } catch (Exception e) {
@@ -516,11 +517,13 @@ public class HiveMetaStoreAuthorizer extends MetaStorePreEventListener implement
     LOG.debug("<== HiveMetaStoreAuthorizer.checkPrivileges(): authzContext=" + authzContext + ", authorizer=" + authorizer);
   }
 
-  private boolean skipAuthorization() {
+  private boolean skipAuthorization(HiveMetaStoreAuthzInfo authzContext) {
     LOG.debug("==> HiveMetaStoreAuthorizer.skipAuthorization()");
 
+    if(authzContext == null){
+      return false;
+    }
     boolean ret = false;
-
     UserGroupInformation ugi = null;
     try {
       ugi = getUGI();