sentry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From linaataus...@apache.org
Subject sentry git commit: SENTRY-2184: Performance Issue: MPath is queried for each MAuthzPathsMapping in full snapshot (Na Li, reviewed by Brian Towles)
Date Mon, 19 Mar 2018 22:41:19 GMT
Repository: sentry
Updated Branches:
  refs/heads/master d3aef7c8a -> 0ec31c0f7


SENTRY-2184: Performance Issue: MPath is queried for each MAuthzPathsMapping in full snapshot
(Na Li, reviewed by Brian Towles)


Project: http://git-wip-us.apache.org/repos/asf/sentry/repo
Commit: http://git-wip-us.apache.org/repos/asf/sentry/commit/0ec31c0f
Tree: http://git-wip-us.apache.org/repos/asf/sentry/tree/0ec31c0f
Diff: http://git-wip-us.apache.org/repos/asf/sentry/diff/0ec31c0f

Branch: refs/heads/master
Commit: 0ec31c0f786a4c8eaca3901eb716297f74cab4ea
Parents: d3aef7c
Author: lina.li <lina.li@cloudera.com>
Authored: Mon Mar 19 13:32:36 2018 -0500
Committer: lina.li <lina.li@cloudera.com>
Committed: Mon Mar 19 17:40:52 2018 -0500

----------------------------------------------------------------------
 .../org/apache/sentry/provider/db/service/model/package.jdo | 6 ++++++
 .../sentry/provider/db/service/persistent/SentryStore.java  | 9 ++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sentry/blob/0ec31c0f/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/package.jdo
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/package.jdo
b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/package.jdo
index d883c51..ebfb191 100644
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/package.jdo
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/package.jdo
@@ -267,6 +267,9 @@
              <column name="AUTHZ_OBJ_ID"/>
            </element>
        </field>
+       <fetch-group name="includingPaths">
+         <field name="paths"/>
+       </fetch-group>
        <field name="authzSnapshotID">
          <column name="AUTHZ_SNAPSHOT_ID" jdbc-type="BIGINT" allows-null="false"/>
        </field>
@@ -279,6 +282,9 @@
       <field name="path">
         <column name="PATH_NAME" length="4000" jdbc-type="VARCHAR"/>
       </field>
+      <fetch-group name="includingPath">
+        <field name="path"/>
+      </fetch-group>
     </class>
 
      <class name="MSentryPermChange" table="SENTRY_PERM_CHANGE" identity-type="application"
detachable="true">

http://git-wip-us.apache.org/repos/asf/sentry/blob/0ec31c0f/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java
b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java
index 4521ad4..d1f71d2 100644
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java
@@ -2605,8 +2605,15 @@ public class SentryStore {
     query.addExtension(LOAD_RESULTS_AT_COMMIT, "false");
     query.setFilter("this.authzSnapshotID == currentSnapshotID");
     query.declareParameters("long currentSnapshotID");
+
+    // Get path in batch to improve performance. The fectch groups are defined in package.jdo
+    pm.getFetchPlan().addGroup("includingPaths");
+    pm.getFetchPlan().addGroup("includingPath");
+    int originalMaxFetchDepth = pm.getFetchPlan().getMaxFetchDepth();
+    pm.getFetchPlan().setMaxFetchDepth(2);
     Collection<MAuthzPathsMapping> authzToPathsMappings =
-            (Collection<MAuthzPathsMapping>) query.execute(currentSnapshotID);
+        (Collection<MAuthzPathsMapping>) query.execute(currentSnapshotID);
+    pm.getFetchPlan().setMaxFetchDepth(originalMaxFetchDepth);
 
     // Walk each MAuthzPathsMapping object, get set of paths and push them all
     // into HMSPaths object contained in UpdateableAuthzPaths.


Mime
View raw message