sentry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kal...@apache.org
Subject sentry git commit: SENTRY-1805 Define a DB schema for HMS generation IDs(Sergio Pena, Reviewed by Alexander Kolbasov, kalyan kumar kalvagadda)
Date Fri, 23 Jun 2017 16:00:49 GMT
Repository: sentry
Updated Branches:
  refs/heads/sentry-ha-redesign c3e92f2f7 -> efb2a059a


SENTRY-1805 Define a DB schema for HMS generation IDs(Sergio Pena, Reviewed by Alexander Kolbasov,
kalyan kumar kalvagadda)


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

Branch: refs/heads/sentry-ha-redesign
Commit: efb2a059a7647d87dfec8242ff527146a6e8ef35
Parents: c3e92f2
Author: Kalyan Kumar Kalvagadda <kkalyan@cloudera.com>
Authored: Fri Jun 23 10:54:16 2017 -0500
Committer: Kalyan Kumar Kalvagadda <kkalyan@cloudera.com>
Committed: Fri Jun 23 10:54:16 2017 -0500

----------------------------------------------------------------------
 .../db/service/model/MAuthzPathsMapping.java    | 14 +++--
 .../db/service/model/MAuthzPathsSnapshotId.java | 63 ++++++++++++++++++++
 .../provider/db/service/model/package.jdo       |  9 +++
 .../db/service/persistent/SentryStore.java      |  9 ++-
 .../main/resources/007-SENTRY-1365.derby.sql    |  3 +-
 .../main/resources/007-SENTRY-1365.mysql.sql    |  2 +-
 .../main/resources/007-SENTRY-1365.oracle.sql   |  3 +-
 .../main/resources/007-SENTRY-1365.postgres.sql |  1 +
 .../main/resources/009-SENTRY-1805.derby.sql    |  8 +++
 .../main/resources/009-SENTRY-1805.mysql.sql    |  6 ++
 .../main/resources/009-SENTRY-1805.oracle.sql   |  8 +++
 .../main/resources/009-SENTRY-1805.postgres.sql |  6 ++
 .../src/main/resources/sentry-db2-1.8.0.sql     | 16 ++++-
 .../src/main/resources/sentry-derby-1.8.0.sql   | 12 +++-
 .../src/main/resources/sentry-mysql-1.8.0.sql   |  8 +++
 .../src/main/resources/sentry-oracle-1.8.0.sql  | 12 +++-
 .../main/resources/sentry-postgres-1.8.0.sql    |  8 +++
 .../sentry-upgrade-db2-1.7.0-to-1.8.0.sql       | 17 +++++-
 .../sentry-upgrade-derby-1.7.0-to-1.8.0.sql     |  1 +
 .../sentry-upgrade-mysql-1.7.0-to-1.8.0.sql     |  1 +
 .../sentry-upgrade-oracle-1.7.0-to-1.8.0.sql    |  1 +
 .../sentry-upgrade-postgres-1.7.0-to-1.8.0.sql  |  1 +
 22 files changed, 195 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sentry/blob/efb2a059/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/MAuthzPathsMapping.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/MAuthzPathsMapping.java
b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/MAuthzPathsMapping.java
index 5471a02..a38772b 100644
--- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/MAuthzPathsMapping.java
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/MAuthzPathsMapping.java
@@ -18,6 +18,8 @@
 
 package org.apache.sentry.provider.db.service.model;
 
+import org.apache.sentry.provider.db.service.persistent.SentryStore;
+
 import javax.jdo.annotations.PersistenceCapable;
 import java.util.Collection;
 import java.util.HashSet;
@@ -30,11 +32,13 @@ import java.util.Set;
 @PersistenceCapable
 public class MAuthzPathsMapping {
 
+  private long authzSnapshotID;
   private String authzObjName;
   private Set<MPath> paths;
   private long createTimeMs;
 
-  public MAuthzPathsMapping(String authzObjName, Collection<String> paths) {
+  public MAuthzPathsMapping(long authzSnapshotID, String authzObjName, Collection<String>
paths) {
+    this.authzSnapshotID = authzSnapshotID;
     this.authzObjName = MSentryUtil.safeIntern(authzObjName);
     this.paths = new HashSet<>(paths.size());
     for (String path : paths) {
@@ -105,8 +109,8 @@ public class MAuthzPathsMapping {
 
   @Override
   public String toString() {
-    return "MSentryPathsUpdate [authzObj=" + authzObjName + "], paths=[" + paths.toString()
-        + "], createTimeMs=[" + String.valueOf(createTimeMs) + "]";
+    return "MSentryPathsUpdate authzSnapshotID=[" + authzSnapshotID + "], authzObj=[" + authzObjName
+        + "], paths=[" + paths.toString() + "], createTimeMs=[" + String.valueOf(createTimeMs)
+ "]";
   }
 
   @Override
@@ -136,7 +140,9 @@ public class MAuthzPathsMapping {
       }
     } else if (!authzObjName.equals(other.authzObjName)) {
       return false;
-    }
+    } else if (authzSnapshotID != other.authzSnapshotID) {
+      return false;
+   }
 
     return true;
   }

http://git-wip-us.apache.org/repos/asf/sentry/blob/efb2a059/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/MAuthzPathsSnapshotId.java
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/MAuthzPathsSnapshotId.java
b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/MAuthzPathsSnapshotId.java
new file mode 100644
index 0000000..d683c2c
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/MAuthzPathsSnapshotId.java
@@ -0,0 +1,63 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sentry.provider.db.service.model;
+
+import javax.jdo.annotations.PersistenceCapable;
+import javax.jdo.annotations.PrimaryKey;
+
+/**
+ * This class is used to persist new authz paths snapshots IDs. An authz path snapshot ID
is required by
+ * the MAuthzPathsMapping to detect new HMS snapshots created by the HMSFollower.
+ */
+@PersistenceCapable
+public class MAuthzPathsSnapshotId {
+  @PrimaryKey
+  private long authzSnapshotID;
+
+  public MAuthzPathsSnapshotId(long authzSnapshotID) {
+    this.authzSnapshotID = authzSnapshotID;
+  }
+
+  @Override
+  public String toString() {
+    return "MAuthzPathsSnapshotId authzSnapshotID=[" + authzSnapshotID + "]";
+  }
+
+  @Override
+  public int hashCode() {
+    return (int)authzSnapshotID;
+  }
+
+  @Override
+  public boolean equals(Object obj) {
+    if (this == obj) {
+      return true;
+    }
+
+    if (obj == null) {
+      return false;
+    }
+
+    if (getClass() != obj.getClass()) {
+      return false;
+    }
+
+    MAuthzPathsSnapshotId other = (MAuthzPathsSnapshotId) obj;
+    return (authzSnapshotID == other.authzSnapshotID);
+  }
+}

http://git-wip-us.apache.org/repos/asf/sentry/blob/efb2a059/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 459939b..e8982f6 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
@@ -237,6 +237,12 @@
       </field>
      </class>
 
+    <class name="MAuthzPathsSnapshotId" identity-type="application" table="AUTHZ_PATHS_SNAPSHOT_ID"
detachable="true">
+       <field name="authzSnapshotID" primary-key="true">
+         <column name="AUTHZ_SNAPSHOT_ID" jdbc-type="BIGINT" allows-null="false"/>
+       </field>
+    </class>
+
     <class name="MAuthzPathsMapping" identity-type="datastore" table="AUTHZ_PATHS_MAPPING"
detachable="true">
        <datastore-identity>
          <column name="AUTHZ_OBJ_ID"/>
@@ -259,6 +265,9 @@
              <column name="AUTHZ_OBJ_ID"/>
            </element>
        </field>
+       <field name="authzSnapshotID">
+         <column name="AUTHZ_SNAPSHOT_ID" jdbc-type="BIGINT" allows-null="false"/>
+       </field>
      </class>
 
     <class name="MPath" identity-type="datastore" table="AUTHZ_PATH" detachable="true">

http://git-wip-us.apache.org/repos/asf/sentry/blob/efb2a059/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 f088f5c..27999cf 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
@@ -125,6 +125,9 @@ public class SentryStore {
 
   public static final long EMPTY_NOTIFICATION_ID = 0L;
 
+  // Representation for empty HMS snapshots not found on MAuthzPathsSnapshotId
+  public static final long EMPTY_AUTHZ_SNAPSHOT_ID = 0L;
+
   // For counters, representation of the "unknown value"
   private static final long COUNT_VALUE_UNKNOWN = -1L;
 
@@ -2576,7 +2579,7 @@ public class SentryStore {
 
     if (mAuthzPathsMapping == null) {
       mAuthzPathsMapping =
-          new MAuthzPathsMapping(authzObj, paths);
+          new MAuthzPathsMapping(EMPTY_AUTHZ_SNAPSHOT_ID, authzObj, paths);
       pm.makePersistent(mAuthzPathsMapping);
     } else {
       throw new SentryAlreadyExistsException("AuthzObj: " + authzObj);
@@ -2617,7 +2620,7 @@ public class SentryStore {
         Collection<String> paths) {
     MAuthzPathsMapping mAuthzPathsMapping = getMAuthzPathsMappingCore(pm, authzObj);
     if (mAuthzPathsMapping == null) {
-      mAuthzPathsMapping = new MAuthzPathsMapping(authzObj, paths);
+      mAuthzPathsMapping = new MAuthzPathsMapping(EMPTY_AUTHZ_SNAPSHOT_ID, authzObj, paths);
     } else {
       for (String path : paths) {
         mAuthzPathsMapping.addPath(new MPath(path));
@@ -2861,7 +2864,7 @@ public class SentryStore {
 
     MAuthzPathsMapping mAuthzPathsMapping = getMAuthzPathsMappingCore(pm, authzObj);
     if (mAuthzPathsMapping == null) {
-      mAuthzPathsMapping = new MAuthzPathsMapping(authzObj, Sets.newHashSet(newPath));
+      mAuthzPathsMapping = new MAuthzPathsMapping(EMPTY_AUTHZ_SNAPSHOT_ID, authzObj, Sets.newHashSet(newPath));
     } else {
       MPath mOldPath = mAuthzPathsMapping.getPath(oldPath);
       if (mOldPath == null) {

http://git-wip-us.apache.org/repos/asf/sentry/blob/efb2a059/sentry-provider/sentry-provider-db/src/main/resources/007-SENTRY-1365.derby.sql
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/resources/007-SENTRY-1365.derby.sql
b/sentry-provider/sentry-provider-db/src/main/resources/007-SENTRY-1365.derby.sql
index 1935ef0..d738230 100644
--- a/sentry-provider/sentry-provider-db/src/main/resources/007-SENTRY-1365.derby.sql
+++ b/sentry-provider/sentry-provider-db/src/main/resources/007-SENTRY-1365.derby.sql
@@ -3,7 +3,8 @@ CREATE TABLE AUTHZ_PATHS_MAPPING
 (
     AUTHZ_OBJ_ID BIGINT NOT NULL generated always as identity (start with 1),
     AUTHZ_OBJ_NAME VARCHAR(384),
-    CREATE_TIME_MS BIGINT NOT NULL
+    CREATE_TIME_MS BIGINT NOT NULL,
+    AUTHZ_SNAPSHOT_ID BIGINT NOT NULL
 );
 
 ALTER TABLE AUTHZ_PATHS_MAPPING ADD CONSTRAINT AUTHZ_PATHS_MAPPING_PK PRIMARY KEY (AUTHZ_OBJ_ID);

http://git-wip-us.apache.org/repos/asf/sentry/blob/efb2a059/sentry-provider/sentry-provider-db/src/main/resources/007-SENTRY-1365.mysql.sql
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/resources/007-SENTRY-1365.mysql.sql
b/sentry-provider/sentry-provider-db/src/main/resources/007-SENTRY-1365.mysql.sql
index 1bcbffb..84eac33 100644
--- a/sentry-provider/sentry-provider-db/src/main/resources/007-SENTRY-1365.mysql.sql
+++ b/sentry-provider/sentry-provider-db/src/main/resources/007-SENTRY-1365.mysql.sql
@@ -4,6 +4,7 @@ CREATE TABLE `AUTHZ_PATHS_MAPPING`
     `AUTHZ_OBJ_ID` BIGINT NOT NULL AUTO_INCREMENT,
     `AUTHZ_OBJ_NAME` VARCHAR(384) BINARY NOT NULL,
     `CREATE_TIME_MS` BIGINT NOT NULL,
+    `AUTHZ_SNAPSHOT_ID` BIGINT NOT NULL,
     CONSTRAINT `AUTHZ_PATHS_MAPPING_PK` PRIMARY KEY (`AUTHZ_OBJ_ID`)
 ) ENGINE=INNODB;
 
@@ -25,5 +26,4 @@ ALTER TABLE `AUTHZ_PATH`
   ADD CONSTRAINT `AUTHZ_PATH_FK`
   FOREIGN KEY (`AUTHZ_OBJ_ID`) REFERENCES `AUTHZ_PATHS_MAPPING`(`AUTHZ_OBJ_ID`);
 
-------------------------------------------------------------------
 -- Sequences and SequenceTables
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/sentry/blob/efb2a059/sentry-provider/sentry-provider-db/src/main/resources/007-SENTRY-1365.oracle.sql
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/resources/007-SENTRY-1365.oracle.sql
b/sentry-provider/sentry-provider-db/src/main/resources/007-SENTRY-1365.oracle.sql
index 081a369..d7d9679 100644
--- a/sentry-provider/sentry-provider-db/src/main/resources/007-SENTRY-1365.oracle.sql
+++ b/sentry-provider/sentry-provider-db/src/main/resources/007-SENTRY-1365.oracle.sql
@@ -3,7 +3,8 @@ CREATE TABLE AUTHZ_PATHS_MAPPING
 (
     AUTHZ_OBJ_ID NUMBER NOT NULL,
     AUTHZ_OBJ_NAME VARCHAR2(384) NULL,
-    CREATE_TIME_MS NUMBER NOT NULL
+    CREATE_TIME_MS NUMBER NOT NULL,
+    AUTHZ_SNAPSHOT_ID NUMBER NOT NULL
 );
 
 ALTER TABLE AUTHZ_PATHS_MAPPING ADD CONSTRAINT AUTHZ_PATHS_MAPPING_PK PRIMARY KEY (AUTHZ_OBJ_ID);

http://git-wip-us.apache.org/repos/asf/sentry/blob/efb2a059/sentry-provider/sentry-provider-db/src/main/resources/007-SENTRY-1365.postgres.sql
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/resources/007-SENTRY-1365.postgres.sql
b/sentry-provider/sentry-provider-db/src/main/resources/007-SENTRY-1365.postgres.sql
index 9456925..cf961f3 100644
--- a/sentry-provider/sentry-provider-db/src/main/resources/007-SENTRY-1365.postgres.sql
+++ b/sentry-provider/sentry-provider-db/src/main/resources/007-SENTRY-1365.postgres.sql
@@ -4,6 +4,7 @@ CREATE TABLE "AUTHZ_PATHS_MAPPING"
     "AUTHZ_OBJ_ID" SERIAL,
     "AUTHZ_OBJ_NAME" varchar(384) NULL,
     "CREATE_TIME_MS" int8 NOT NULL,
+    "AUTHZ_SNAPSHOT_ID" bigint NOT NULL,
     CONSTRAINT "AUTHZ_PATHS_MAPPING_PK" PRIMARY KEY ("AUTHZ_OBJ_ID")
 );
 

http://git-wip-us.apache.org/repos/asf/sentry/blob/efb2a059/sentry-provider/sentry-provider-db/src/main/resources/009-SENTRY-1805.derby.sql
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/resources/009-SENTRY-1805.derby.sql
b/sentry-provider/sentry-provider-db/src/main/resources/009-SENTRY-1805.derby.sql
new file mode 100644
index 0000000..372d6a6
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/main/resources/009-SENTRY-1805.derby.sql
@@ -0,0 +1,8 @@
+-- Table AUTHZ_PATHS_SNAPSHOT_ID for class [org.apache.sentry.provider.db.service.model.MAuthzPathsSnapshotId]
+CREATE TABLE AUTHZ_PATHS_SNAPSHOT_ID
+(
+    AUTHZ_SNAPSHOT_ID BIGINT NOT NULL
+);
+
+-- Constraints for table AUTHZ_PATHS_SNAPSHOT_ID for class [org.apache.sentry.provider.db.service.model.MAuthzPathsSnapshotId]
+ALTER TABLE AUTHZ_PATHS_SNAPSHOT_ID ADD CONSTRAINT AUTHZ_SNAPSHOT_ID_PK PRIMARY KEY (AUTHZ_SNAPSHOT_ID);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/sentry/blob/efb2a059/sentry-provider/sentry-provider-db/src/main/resources/009-SENTRY-1805.mysql.sql
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/resources/009-SENTRY-1805.mysql.sql
b/sentry-provider/sentry-provider-db/src/main/resources/009-SENTRY-1805.mysql.sql
new file mode 100644
index 0000000..7f0e911
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/main/resources/009-SENTRY-1805.mysql.sql
@@ -0,0 +1,6 @@
+-- Table AUTHZ_PATHS_SNAPSHOT_ID for class [org.apache.sentry.provider.db.service.model.MAuthzPathsSnapshotId]
+CREATE TABLE `AUTHZ_PATHS_SNAPSHOT_ID`
+(
+    `AUTHZ_SNAPSHOT_ID` BIGINT NOT NULL,
+    CONSTRAINT `AUTHZ_SNAPSHOT_ID_PK` PRIMARY KEY (`AUTHZ_SNAPSHOT_ID`)
+)ENGINE=INNODB;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/sentry/blob/efb2a059/sentry-provider/sentry-provider-db/src/main/resources/009-SENTRY-1805.oracle.sql
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/resources/009-SENTRY-1805.oracle.sql
b/sentry-provider/sentry-provider-db/src/main/resources/009-SENTRY-1805.oracle.sql
new file mode 100644
index 0000000..0f44bcf
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/main/resources/009-SENTRY-1805.oracle.sql
@@ -0,0 +1,8 @@
+-- Table AUTHZ_PATHS_SNAPSHOT_ID for class [org.apache.sentry.provider.db.service.model.MAuthzPathsSnapshotId]
+CREATE TABLE AUTHZ_PATHS_SNAPSHOT_ID
+(
+    AUTHZ_SNAPSHOT_ID NUMBER NOT NULL
+);
+
+-- Constraints for table AUTHZ_PATHS_SNAPSHOT_ID for class [org.apache.sentry.provider.db.service.model.MAuthzPathsSnapshotId]
+ALTER TABLE AUTHZ_PATHS_SNAPSHOT_ID ADD CONSTRAINT AUTHZ_SNAPSHOT_ID_PK PRIMARY KEY (AUTHZ_SNAPSHOT_ID);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/sentry/blob/efb2a059/sentry-provider/sentry-provider-db/src/main/resources/009-SENTRY-1805.postgres.sql
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/resources/009-SENTRY-1805.postgres.sql
b/sentry-provider/sentry-provider-db/src/main/resources/009-SENTRY-1805.postgres.sql
new file mode 100644
index 0000000..2ace5eb
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/main/resources/009-SENTRY-1805.postgres.sql
@@ -0,0 +1,6 @@
+-- Table AUTHZ_PATHS_SNAPSHOT_ID for class [org.apache.sentry.provider.db.service.model.MAuthzPathsSnapshotId]
+CREATE TABLE "AUTHZ_PATHS_SNAPSHOT_ID"
+(
+    "AUTHZ_SNAPSHOT_ID" bigint NOT NULL,
+    CONSTRAINT "AUTHZ_SNAPSHOT_ID_PK" PRIMARY KEY ("AUTHZ_SNAPSHOT_ID")
+);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/sentry/blob/efb2a059/sentry-provider/sentry-provider-db/src/main/resources/sentry-db2-1.8.0.sql
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/resources/sentry-db2-1.8.0.sql b/sentry-provider/sentry-provider-db/src/main/resources/sentry-db2-1.8.0.sql
index 83cbfe7..7ade0a4 100644
--- a/sentry-provider/sentry-provider-db/src/main/resources/sentry-db2-1.8.0.sql
+++ b/sentry-provider/sentry-provider-db/src/main/resources/sentry-db2-1.8.0.sql
@@ -182,8 +182,22 @@ ALTER TABLE SENTRY_ROLE_USER_MAP ADD CONSTRAINT SENTRY_ROLE_USER_MAP_FK2
FOREIGN
 
 ALTER TABLE SENTRY_ROLE_USER_MAP ADD CONSTRAINT SENTRY_ROLE_USER_MAP_FK1 FOREIGN KEY (USER_ID)
REFERENCES SENTRY_USER (USER_ID) ;
 
+-- Table AUTHZ_PATHS_SNAPSHOT_ID for class [org.apache.sentry.provider.db.service.model.MAuthzPathsSnapshotId]
+CREATE TABLE AUTHZ_PATHS_SNAPSHOT_ID
+(
+    AUTHZ_SNAPSHOT_ID BIGINT NOT NULL
+);
+
+-- Constraints for table AUTHZ_PATHS_SNAPSHOT_ID for class [org.apache.sentry.provider.db.service.model.MAuthzPathsSnapshotId]
+ALTER TABLE AUTHZ_PATHS_SNAPSHOT_ID ADD CONSTRAINT AUTHZ_SNAPSHOT_ID_PK PRIMARY KEY (AUTHZ_SNAPSHOT_ID);
+
 -- Table AUTHZ_PATHS_MAPPING for classes [org.apache.sentry.provider.db.service.model.MAuthzPathsMapping]
-CREATE TABLE AUTHZ_PATHS_MAPPING(AUTHZ_OBJ_ID BIGINT NOT NULL generated always as identity
(start with 1),AUTHZ_OBJ_NAME VARCHAR(384),CREATE_TIME_MS BIGINT NOT NULL);
+CREATE TABLE AUTHZ_PATHS_MAPPING(
+    AUTHZ_OBJ_ID BIGINT NOT NULL generated always as identity (start with 1),
+    AUTHZ_OBJ_NAME VARCHAR(384),
+    CREATE_TIME_MS BIGINT NOT NULL,
+    AUTHZ_SNAPSHOT_ID BIGINT NOT NULL
+);
 
 ALTER TABLE AUTHZ_PATHS_MAPPING ADD CONSTRAINT AUTHZ_PATHSCO7K_PK PRIMARY KEY (AUTHZ_OBJ_ID);
 

http://git-wip-us.apache.org/repos/asf/sentry/blob/efb2a059/sentry-provider/sentry-provider-db/src/main/resources/sentry-derby-1.8.0.sql
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/resources/sentry-derby-1.8.0.sql
b/sentry-provider/sentry-provider-db/src/main/resources/sentry-derby-1.8.0.sql
index 1024e8e..077dbe1 100644
--- a/sentry-provider/sentry-provider-db/src/main/resources/sentry-derby-1.8.0.sql
+++ b/sentry-provider/sentry-provider-db/src/main/resources/sentry-derby-1.8.0.sql
@@ -182,11 +182,21 @@ ALTER TABLE SENTRY_ROLE_USER_MAP ADD CONSTRAINT SENTRY_ROLE_USER_MAP_FK2
FOREIGN
 
 ALTER TABLE SENTRY_ROLE_USER_MAP ADD CONSTRAINT SENTRY_ROLE_USER_MAP_FK1 FOREIGN KEY (USER_ID)
REFERENCES SENTRY_USER (USER_ID) ;
 
+-- Table AUTHZ_PATHS_SNAPSHOT_ID for class [org.apache.sentry.provider.db.service.model.MAuthzPathsSnapshotId]
+CREATE TABLE AUTHZ_PATHS_SNAPSHOT_ID
+(
+    AUTHZ_SNAPSHOT_ID BIGINT NOT NULL
+);
+
+-- Constraints for table AUTHZ_PATHS_SNAPSHOT_ID for class [org.apache.sentry.provider.db.service.model.MAuthzPathsSnapshotId]
+ALTER TABLE AUTHZ_PATHS_SNAPSHOT_ID ADD CONSTRAINT AUTHZ_SNAPSHOT_ID_PK PRIMARY KEY (AUTHZ_SNAPSHOT_ID);
+
 CREATE TABLE AUTHZ_PATHS_MAPPING
 (
     AUTHZ_OBJ_ID BIGINT NOT NULL generated always as identity (start with 1),
     AUTHZ_OBJ_NAME VARCHAR(384),
-    CREATE_TIME_MS BIGINT NOT NULL
+    CREATE_TIME_MS BIGINT NOT NULL,
+    AUTHZ_SNAPSHOT_ID BIGINT NOT NULL
 );
 
 ALTER TABLE AUTHZ_PATHS_MAPPING ADD CONSTRAINT AUTHZ_PATHS_MAPPING_PK PRIMARY KEY (AUTHZ_OBJ_ID);

http://git-wip-us.apache.org/repos/asf/sentry/blob/efb2a059/sentry-provider/sentry-provider-db/src/main/resources/sentry-mysql-1.8.0.sql
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/resources/sentry-mysql-1.8.0.sql
b/sentry-provider/sentry-provider-db/src/main/resources/sentry-mysql-1.8.0.sql
index 2c7c8b6..4066a50 100644
--- a/sentry-provider/sentry-provider-db/src/main/resources/sentry-mysql-1.8.0.sql
+++ b/sentry-provider/sentry-provider-db/src/main/resources/sentry-mysql-1.8.0.sql
@@ -221,12 +221,20 @@ ALTER TABLE `SENTRY_ROLE_USER_MAP`
 	 ADD CONSTRAINT `SEN_ROLE_USER_MAP_SEN_USER_FK`
 	 FOREIGN KEY (`USER_ID`) REFERENCES `SENTRY_USER`(`USER_ID`);
 
+-- Table AUTHZ_PATHS_SNAPSHOT_ID for class [org.apache.sentry.provider.db.service.model.MAuthzPathsSnapshotId]
+CREATE TABLE `AUTHZ_PATHS_SNAPSHOT_ID`
+(
+    `AUTHZ_SNAPSHOT_ID` BIGINT NOT NULL,
+    CONSTRAINT `AUTHZ_SNAPSHOT_ID_PK` PRIMARY KEY (`AUTHZ_SNAPSHOT_ID`)
+)ENGINE=INNODB;
+
 -- Table `AUTHZ_PATHS_MAPPING` for classes [org.apache.sentry.provider.db.service.model.MAuthzPathsMapping]
 CREATE TABLE `AUTHZ_PATHS_MAPPING`
 (
     `AUTHZ_OBJ_ID` BIGINT NOT NULL AUTO_INCREMENT,
     `AUTHZ_OBJ_NAME` VARCHAR(384) BINARY NULL,
     `CREATE_TIME_MS` BIGINT NOT NULL,
+    `AUTHZ_SNAPSHOT_ID` BIGINT NOT NULL,
     CONSTRAINT `AUTHZ_PATHS_MAPPING_PK` PRIMARY KEY (`AUTHZ_OBJ_ID`)
 ) ENGINE=INNODB;
 

http://git-wip-us.apache.org/repos/asf/sentry/blob/efb2a059/sentry-provider/sentry-provider-db/src/main/resources/sentry-oracle-1.8.0.sql
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/resources/sentry-oracle-1.8.0.sql
b/sentry-provider/sentry-provider-db/src/main/resources/sentry-oracle-1.8.0.sql
index 590d48c..b02294a 100644
--- a/sentry-provider/sentry-provider-db/src/main/resources/sentry-oracle-1.8.0.sql
+++ b/sentry-provider/sentry-provider-db/src/main/resources/sentry-oracle-1.8.0.sql
@@ -196,12 +196,22 @@ ALTER TABLE "SENTRY_ROLE_USER_MAP"
   ADD CONSTRAINT "SEN_ROLE_USER_MAP_SEN_USER_FK"
   FOREIGN KEY ("USER_ID") REFERENCES "SENTRY_USER"("USER_ID") INITIALLY DEFERRED;
 
+-- Table AUTHZ_PATHS_SNAPSHOT_ID for class [org.apache.sentry.provider.db.service.model.MAuthzPathsSnapshotId]
+CREATE TABLE "AUTHZ_PATHS_SNAPSHOT_ID"
+(
+    "AUTHZ_SNAPSHOT_ID" NUMBER NOT NULL
+);
+
+-- Constraints for table AUTHZ_PATHS_SNAPSHOT_ID for class [org.apache.sentry.provider.db.service.model.MAuthzPathsSnapshotId]
+ALTER TABLE "AUTHZ_PATHS_SNAPSHOT_ID" ADD CONSTRAINT "AUTHZ_SNAPSHOT_ID_PK" PRIMARY KEY ("AUTHZ_SNAPSHOT_ID");
+
 -- Table AUTHZ_PATHS_MAPPING for classes [org.apache.sentry.provider.db.service.model.MAuthzPathsMapping]
 CREATE TABLE AUTHZ_PATHS_MAPPING
 (
     AUTHZ_OBJ_ID NUMBER NOT NULL,
     AUTHZ_OBJ_NAME VARCHAR2(384) NULL,
-    CREATE_TIME_MS NUMBER NOT NULL
+    CREATE_TIME_MS NUMBER NOT NULL,
+    "AUTHZ_SNAPSHOT_ID" NUMBER NOT NULL
 );
 
 ALTER TABLE AUTHZ_PATHS_MAPPING ADD CONSTRAINT AUTHZ_PATHS_MAPPING_PK PRIMARY KEY (AUTHZ_OBJ_ID);

http://git-wip-us.apache.org/repos/asf/sentry/blob/efb2a059/sentry-provider/sentry-provider-db/src/main/resources/sentry-postgres-1.8.0.sql
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/resources/sentry-postgres-1.8.0.sql
b/sentry-provider/sentry-provider-db/src/main/resources/sentry-postgres-1.8.0.sql
index 125be9e..f325eb6 100644
--- a/sentry-provider/sentry-provider-db/src/main/resources/sentry-postgres-1.8.0.sql
+++ b/sentry-provider/sentry-provider-db/src/main/resources/sentry-postgres-1.8.0.sql
@@ -208,12 +208,20 @@ ALTER TABLE ONLY "SENTRY_ROLE_USER_MAP"
   ADD CONSTRAINT "SEN_ROLE_USER_MAP_SEN_USER_FK"
   FOREIGN KEY ("USER_ID") REFERENCES "SENTRY_USER"("USER_ID") DEFERRABLE;
 
+-- Table AUTHZ_PATHS_SNAPSHOT_ID for class [org.apache.sentry.provider.db.service.model.MAuthzPathsSnapshotId]
+CREATE TABLE "AUTHZ_PATHS_SNAPSHOT_ID"
+(
+    "AUTHZ_SNAPSHOT_ID" bigint NOT NULL,
+    CONSTRAINT "AUTHZ_SNAPSHOT_ID_PK" PRIMARY KEY ("AUTHZ_SNAPSHOT_ID")
+);
+
 -- Table "AUTHZ_PATHS_MAPPING" for classes [org.apache.sentry.provider.db.service.model.MAuthzPathsMapping]
 CREATE TABLE "AUTHZ_PATHS_MAPPING"
 (
     "AUTHZ_OBJ_ID" SERIAL,
     "AUTHZ_OBJ_NAME" varchar(384) NULL,
     "CREATE_TIME_MS" int8 NOT NULL,
+    "AUTHZ_SNAPSHOT_ID" bigint NOT NULL,
     CONSTRAINT "AUTHZ_PATHS_MAPPING_PK" PRIMARY KEY ("AUTHZ_OBJ_ID")
 );
 

http://git-wip-us.apache.org/repos/asf/sentry/blob/efb2a059/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-db2-1.7.0-to-1.8.0.sql
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-db2-1.7.0-to-1.8.0.sql
b/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-db2-1.7.0-to-1.8.0.sql
index c7d11d3..8cb8eeb 100644
--- a/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-db2-1.7.0-to-1.8.0.sql
+++ b/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-db2-1.7.0-to-1.8.0.sql
@@ -27,9 +27,24 @@ ALTER TABLE SENTRY_ROLE_USER_MAP ADD CONSTRAINT SENTRY_ROLE_USER_MAP_FK2
FOREIGN
 
 ALTER TABLE SENTRY_ROLE_USER_MAP ADD CONSTRAINT SENTRY_ROLE_USER_MAP_FK1 FOREIGN KEY (USER_ID)
REFERENCES SENTRY_USER (USER_ID) ;
 
+-- SENTRY-1805
+-- Table AUTHZ_PATHS_SNAPSHOT_ID for class [org.apache.sentry.provider.db.service.model.MAuthzPathsSnapshotId]
+CREATE TABLE AUTHZ_PATHS_SNAPSHOT_ID
+(
+    AUTHZ_SNAPSHOT_ID bigint NOT NULL
+);
+
+-- Constraints for table AUTHZ_PATHS_SNAPSHOT_ID for class [org.apache.sentry.provider.db.service.model.MAuthzPathsSnapshotId]
+ALTER TABLE AUTHZ_PATHS_SNAPSHOT_ID ADD CONSTRAINT AUTHZ_SNAPSHOT_ID_PK PRIMARY KEY (AUTHZ_SNAPSHOT_ID);
+
 -- SENTRY-1365
 -- Table AUTHZ_PATHS_MAPPING for classes [org.apache.sentry.provider.db.service.model.MAuthzPathsMapping]
- CREATE TABLE AUTHZ_PATHS_MAPPING(AUTHZ_OBJ_ID BIGINT NOT NULL generated always as identity
(start with 1),AUTHZ_OBJ_NAME VARCHAR(384),CREATE_TIME_MS BIGINT NOT NULL);
+ CREATE TABLE AUTHZ_PATHS_MAPPING(
+    AUTHZ_OBJ_ID BIGINT NOT NULL generated always as identity (start with 1),
+    AUTHZ_OBJ_NAME VARCHAR(384),
+    CREATE_TIME_MS BIGINT NOT NULL,
+    AUTHZ_SNAPSHOT_ID BIGINT NOT NULL
+);
 
  ALTER TABLE AUTHZ_PATHS_MAPPING ADD CONSTRAINT AUTHZ_PATHSCO7K_PK PRIMARY KEY (AUTHZ_OBJ_ID);
 

http://git-wip-us.apache.org/repos/asf/sentry/blob/efb2a059/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-derby-1.7.0-to-1.8.0.sql
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-derby-1.7.0-to-1.8.0.sql
b/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-derby-1.7.0-to-1.8.0.sql
index dc3021a..30397f7 100644
--- a/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-derby-1.7.0-to-1.8.0.sql
+++ b/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-derby-1.7.0-to-1.8.0.sql
@@ -1,6 +1,7 @@
 RUN '006-SENTRY-711.derby.sql';
 RUN '007-SENTRY-1365.derby.sql';
 RUN '008-SENTRY-1569.derby.sql';
+RUN '009-SENTRY-1805.derby.sql';
 
 -- Version update
 UPDATE SENTRY_VERSION SET SCHEMA_VERSION='1.8.0', VERSION_COMMENT='Sentry release version
1.8.0' WHERE VER_ID=1;

http://git-wip-us.apache.org/repos/asf/sentry/blob/efb2a059/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-mysql-1.7.0-to-1.8.0.sql
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-mysql-1.7.0-to-1.8.0.sql
b/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-mysql-1.7.0-to-1.8.0.sql
index ef1c651..0a95571 100644
--- a/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-mysql-1.7.0-to-1.8.0.sql
+++ b/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-mysql-1.7.0-to-1.8.0.sql
@@ -2,6 +2,7 @@ SELECT 'Upgrading Sentry store schema from 1.7.0 to 1.8.0' AS ' ';
 SOURCE 006-SENTRY-711.mysql.sql;
 SOURCE 007-SENTRY-1365.mysql.sql;
 SOURCE 008-SENTRY-1569.mysql.sql;
+SOURCE 009-SENTRY-1805.mysql.sql;
 
 UPDATE SENTRY_VERSION SET SCHEMA_VERSION='1.8.0', VERSION_COMMENT='Sentry release version
1.8.0' WHERE VER_ID=1;
 

http://git-wip-us.apache.org/repos/asf/sentry/blob/efb2a059/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-oracle-1.7.0-to-1.8.0.sql
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-oracle-1.7.0-to-1.8.0.sql
b/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-oracle-1.7.0-to-1.8.0.sql
index f4a50de..3241ef9 100644
--- a/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-oracle-1.7.0-to-1.8.0.sql
+++ b/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-oracle-1.7.0-to-1.8.0.sql
@@ -2,6 +2,7 @@ SELECT 'Upgrading Sentry store schema from 1.7.0 to 1.8.0' AS Status from
dual;
 @006-SENTRY-711.oracle.sql;
 @007-SENTRY-1365.oracle.sql;
 @008-SENTRY-1569.oracle.sql;
+@009-SENTRY-1805.oracle.sql;
 
 UPDATE SENTRY_VERSION SET SCHEMA_VERSION='1.8.0', VERSION_COMMENT='Sentry release version
1.8.0' WHERE VER_ID=1;
 

http://git-wip-us.apache.org/repos/asf/sentry/blob/efb2a059/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-postgres-1.7.0-to-1.8.0.sql
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-postgres-1.7.0-to-1.8.0.sql
b/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-postgres-1.7.0-to-1.8.0.sql
index db010bc..af362f6 100644
--- a/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-postgres-1.7.0-to-1.8.0.sql
+++ b/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-postgres-1.7.0-to-1.8.0.sql
@@ -2,6 +2,7 @@ SELECT 'Upgrading Sentry store schema from 1.7.0 to 1.8.0';
 \i 006-SENTRY-711.postgres.sql;
 \i 007-SENTRY-1365.postgres.sql;
 \i 008-SENTRY-1569.postgres.sql;
+\i 009-SENTRY-1805.postgres.sql;
 
 UPDATE "SENTRY_VERSION" SET "SCHEMA_VERSION"='1.8.0', "VERSION_COMMENT"='Sentry release version
1.8.0' WHERE "VER_ID"=1;
 


Mime
View raw message