sentry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ak...@apache.org
Subject sentry git commit: SENTRY-1710: Reduce datanucleus key cache size for MSentryPermChange and MSentryPathChange tables (Lei Xu, reviewed by Alex Kolbasov, Hao Hao and Na Li)
Date Fri, 21 Apr 2017 00:42:42 GMT
Repository: sentry
Updated Branches:
  refs/heads/sentry-ha-redesign ff369db20 -> 6835fa95b


SENTRY-1710: Reduce datanucleus key cache size for MSentryPermChange and MSentryPathChange
tables (Lei Xu, reviewed by Alex Kolbasov, Hao Hao and Na Li)


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

Branch: refs/heads/sentry-ha-redesign
Commit: 6835fa95bf47372f16adb9363577244201587398
Parents: ff369db
Author: Alexander Kolbasov <akolb@cloudera.com>
Authored: Thu Apr 20 17:42:15 2017 -0700
Committer: Alexander Kolbasov <akolb@cloudera.com>
Committed: Thu Apr 20 17:42:15 2017 -0700

----------------------------------------------------------------------
 .../sentry/provider/db/service/model/MSentryPathChange.java    | 3 +--
 .../sentry/provider/db/service/model/MSentryPermChange.java    | 3 +--
 .../org/apache/sentry/provider/db/service/model/package.jdo    | 4 ++--
 .../provider/db/service/persistent/DeltaTransactionBlock.java  | 6 ++----
 4 files changed, 6 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sentry/blob/6835fa95/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/MSentryPathChange.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/MSentryPathChange.java
b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/MSentryPathChange.java
index 4b42ed0..42f80aa 100644
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/MSentryPathChange.java
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/MSentryPathChange.java
@@ -67,7 +67,7 @@ public class MSentryPathChange implements MSentryChange {
   private long createTimeMs;
   private long notificationID;
 
-  public MSentryPathChange(long changeID, PathsUpdate pathChange) throws TException {
+  public MSentryPathChange(PathsUpdate pathChange) throws TException {
     // Each PathsUpdate maps to a MSentryPathChange object.
     // The PathsUpdate is generated from a HMS notification log,
     // the notification ID is stored as seqNum and
@@ -75,7 +75,6 @@ public class MSentryPathChange implements MSentryChange {
     //
     // See SENTRY-1643. changeID is set after increasing 1 of the "max(changeID)" fetched
from
     // the table, to avoid holes between changeIDs. it is subjected to change.
-    this.changeID = changeID;
     this.notificationID = pathChange.getSeqNum();
     this.pathChange = pathChange.JSONSerialize();
     this.createTimeMs = System.currentTimeMillis();

http://git-wip-us.apache.org/repos/asf/sentry/blob/6835fa95/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/MSentryPermChange.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/MSentryPermChange.java
b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/MSentryPermChange.java
index a97d10a..8d9528f 100644
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/MSentryPermChange.java
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/MSentryPermChange.java
@@ -64,10 +64,9 @@ public class MSentryPermChange implements MSentryChange {
   private String permChange;
   private long createTimeMs;
 
-  public MSentryPermChange(long changeID, PermissionsUpdate permChange) throws TException
{
+  public MSentryPermChange(PermissionsUpdate permChange) throws TException {
     // See SENTRY-1643. changeID is set after increasing 1 of the "max(changeID)" fetched
from
     // the table, to avoid holes between changeIDs. it is subjected to change.
-    this.changeID = changeID;
     this.permChange = permChange.JSONSerialize();
     this.createTimeMs = System.currentTimeMillis();
   }

http://git-wip-us.apache.org/repos/asf/sentry/blob/6835fa95/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 81a4c6e..8fd5278 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
@@ -271,7 +271,7 @@
     </class>
 
      <class name="MSentryPermChange" table="SENTRY_PERM_CHANGE" identity-type="application"
detachable="true">
-       <field name="changeID" primary-key="true" value-strategy="increment">
+       <field name="changeID" primary-key="true" value-strategy="increment" key-cache-size="1">
          <column name="CHANGE_ID" jdbc-type="BIGINT" allows-null="false"/>
        </field>
        <field name ="permChange">
@@ -283,7 +283,7 @@
      </class>
 
      <class name="MSentryPathChange" table="SENTRY_PATH_CHANGE" identity-type="application"
detachable="true">
-       <field name="changeID" primary-key="true" value-strategy="increment">
+       <field name="changeID" primary-key="true" value-strategy="increment" key-cache-size="1">
          <column name="CHANGE_ID" jdbc-type="BIGINT" allows-null="false"/>
        </field>
        <field name="notificationID">

http://git-wip-us.apache.org/repos/asf/sentry/blob/6835fa95/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/DeltaTransactionBlock.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/DeltaTransactionBlock.java
b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/DeltaTransactionBlock.java
index 8d3c88b..f590a52 100644
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/DeltaTransactionBlock.java
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/DeltaTransactionBlock.java
@@ -83,11 +83,9 @@ public class DeltaTransactionBlock implements TransactionBlock<Object>
{
     // changeID is trying to be persisted twice, the transaction would
     // fail.
     if (update instanceof PermissionsUpdate) {
-      long lastChangeID = SentryStore.getLastProcessedChangeIDCore(pm, MSentryPermChange.class);
-      pm.makePersistent(new MSentryPermChange(lastChangeID + 1, (PermissionsUpdate)update));
+      pm.makePersistent(new MSentryPermChange((PermissionsUpdate)update));
     } else if (update instanceof PathsUpdate) {
-      long lastChangeID = SentryStore.getLastProcessedChangeIDCore(pm, MSentryPathChange.class);
-      pm.makePersistent(new MSentryPathChange(lastChangeID + 1, (PathsUpdate)update));
+      pm.makePersistent(new MSentryPathChange((PathsUpdate)update));
     } else {
       throw new SentryInvalidInputException("Update should be type of either " +
           "PermissionsUpdate or PathsUpdate.\n");


Mime
View raw message