sentry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ha...@apache.org
Subject sentry git commit: SENTRY-1448: Store processed notification sequence ID in database (Hao Hao, Reviewed by: Vamsee Yarlagadda)
Date Wed, 22 Feb 2017 00:36:35 GMT
Repository: sentry
Updated Branches:
  refs/heads/sentry-ha-redesign e3aaa7fb7 -> 33d9f6fe4


SENTRY-1448: Store processed notification sequence ID in database (Hao Hao, Reviewed by: Vamsee
Yarlagadda)

Change-Id: Ib47f2b37e82e7306e78809b8340b17e0b8cab930


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

Branch: refs/heads/sentry-ha-redesign
Commit: 33d9f6fe45d7b5149ee2ea472b58045b1eccbed2
Parents: e3aaa7f
Author: hahao <hao.hao@cloudera.com>
Authored: Tue Feb 21 16:35:36 2017 -0800
Committer: hahao <hao.hao@cloudera.com>
Committed: Tue Feb 21 16:35:36 2017 -0800

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


http://git-wip-us.apache.org/repos/asf/sentry/blob/33d9f6fe/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 952b11f..12e9a09 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
@@ -26,8 +26,8 @@ import javax.jdo.annotations.PrimaryKey;
 
 /**
  * Database backend store for HMS path delta change. Each record contains
- * change ID, JSON format of a single &lt Hive Obj, HDFS Path &gt change, and
- * timestamp.
+ * change ID, HMS notification ID, JSON format of a single
+ * &lt Hive Obj, HDFS Path &gt change, and timestamp.
  * <p>
  * e.g. for add paths change in JSON format.
  * <pre>
@@ -65,8 +65,14 @@ public class MSentryPathChange {
   // Path change in JSON format.
   private String pathChange;
   private long createTimeMs;
+  private long notificationID;
 
   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
+    // the notification update is serialized as JSON string.
+    this.notificationID = pathChange.getSeqNum();
     this.pathChange = pathChange.JSONSerialize();
     this.createTimeMs = System.currentTimeMillis();
   }
@@ -85,7 +91,8 @@ public class MSentryPathChange {
 
   @Override
   public String toString() {
-    return "MSentryChange [changeID=" + changeID + " , pathChange= " + pathChange +
+    return "MSentryChange [changeID=" + changeID + " , notificationID= "
+        + notificationID +" , pathChange= " + pathChange +
         ", createTime=" + createTimeMs +  "]";
   }
 
@@ -94,6 +101,7 @@ public class MSentryPathChange {
     final int prime = 31;
     int result = 1;
     result = prime * result + Long.valueOf(changeID).hashCode();
+    result = prime * result + Long.valueOf(notificationID).hashCode();
     result = prime * result + ((pathChange == null) ? 0 : pathChange.hashCode());
     return result;
   }
@@ -117,6 +125,10 @@ public class MSentryPathChange {
       return false;
     }
 
+    if (notificationID != other.notificationID) {
+      return false;
+    }
+
     if (createTimeMs != other.createTimeMs) {
       return false;
     }

http://git-wip-us.apache.org/repos/asf/sentry/blob/33d9f6fe/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 94ede1d..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
@@ -278,6 +278,9 @@
        <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"/>
+       </field>
        <field name ="pathChange">
          <column name="PATH_CHANGE" length="4000" jdbc-type="VARCHAR" allows-null="false"/>
        </field>


Mime
View raw message