You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sentry.apache.org by ak...@apache.org on 2017/03/01 22:51:26 UTC

sentry git commit: Revert "SENTRY-1638: Update MSentryPermChange table to add a column for notification ID (Lei Xu, Reviewed by: Alex Kolbasov)"

Repository: sentry
Updated Branches:
  refs/heads/sentry-ha-redesign 520907641 -> 7aac09ec6


Revert "SENTRY-1638: Update MSentryPermChange table to add a column for notification ID (Lei Xu, Reviewed by: Alex Kolbasov)"

This reverts commit 5209076418d93c12404057ac52bf5c21c783fea9.
  Issues discovered during code review.


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

Branch: refs/heads/sentry-ha-redesign
Commit: 7aac09ec6351b7c7f8281ce6032efbb1239f5ad6
Parents: 5209076
Author: Alexander Kolbasov <ak...@cloudera.com>
Authored: Wed Mar 1 14:50:53 2017 -0800
Committer: Alexander Kolbasov <ak...@cloudera.com>
Committed: Wed Mar 1 14:50:53 2017 -0800

----------------------------------------------------------------------
 .../db/service/model/MSentryPermChange.java       | 18 +++---------------
 .../sentry/provider/db/service/model/package.jdo  |  5 -----
 2 files changed, 3 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sentry/blob/7aac09ec/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 7f1b739..476fbcb 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
@@ -27,7 +27,7 @@ import javax.jdo.annotations.PrimaryKey;
 
 /**
  * Database backend store for Sentry permission delta change. Each record
- * contains change ID, HMS notification ID, JSON format of a single Sentry permission change,
+ * contains change ID, JSON format of a single Sentry permission change,
  * and timestamp.
  * <p>
  * e.g. for rename privileges change in JSON format.
@@ -63,14 +63,8 @@ public class MSentryPermChange implements MSentryChange {
   // Permission change in JSON format.
   private String permChange;
   private long createTimeMs;
-  private long notificationID;
 
   public MSentryPermChange(PermissionsUpdate permChange) throws TException {
-    // Each PathsUpdate maps to a MSentryPermChange object.
-    // The PathsUpdate is generated from a HMS notification log,
-    // the notification ID is stored as seqNum and
-    // the notification update is serialized as JSON string.
-    this.notificationID = permChange.getSeqNum();
     this.permChange = permChange.JSONSerialize();
     this.createTimeMs = System.currentTimeMillis();
   }
@@ -89,9 +83,8 @@ public class MSentryPermChange implements MSentryChange {
 
   @Override
   public String toString() {
-    return String.format(
-        "MSentryPermChange [changeID=%d, notificationID=%d, permChange=%s, createTimeMs=%d]",
-        changeID, notificationID, permChange, createTimeMs);
+    return "MSentryPermChange [changeID=" + changeID + ", permChange= " + permChange +
+        ", createTimeMs=" + createTimeMs +  "]";
   }
 
   @Override
@@ -99,7 +92,6 @@ public class MSentryPermChange implements MSentryChange {
     final int prime = 31;
     int result = 1;
     result = prime * result + Long.valueOf(changeID).hashCode();
-    result = prime * result + Long.valueOf(notificationID).hashCode();
     result = prime * result + ((permChange == null) ? 0 : permChange.hashCode());
     return result;
   }
@@ -123,10 +115,6 @@ public class MSentryPermChange implements MSentryChange {
       return false;
     }
 
-    if (notificationID != other.notificationID) {
-      return false;
-    }
-
     if (createTimeMs != other.createTimeMs) {
       return false;
     }

http://git-wip-us.apache.org/repos/asf/sentry/blob/7aac09ec/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 fc84df6..e981bcf 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
@@ -266,10 +266,6 @@
        <field name="changeID" primary-key="true" value-strategy="increment">
          <column name="CHANGE_ID" jdbc-type="BIGINT" allows-null="false"/>
        </field>
-       <field name="notificationID">
-         <column name="NOTIFICATION_ID" jdbc-type="BIGINT" allows-null="false"/>
-         <index name="NotificationID" unique="true"/>
-       </field>
        <field name ="permChange">
          <column name="PERM_CHANGE" length="4000" jdbc-type="VARCHAR" allows-null="false"/>
        </field>
@@ -284,7 +280,6 @@
        </field>
        <field name="notificationID">
          <column name="NOTIFICATION_ID" jdbc-type="BIGINT" allows-null="false"/>
-         <index name="NotificationID" unique="true"/>
        </field>
        <field name ="pathChange">
          <column name="PATH_CHANGE" length="4000" jdbc-type="VARCHAR" allows-null="false"/>