sentry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vam...@apache.org
Subject sentry git commit: SENTRY-1913: Incorrect constraints on AUTHZ_PATHS_MAPPING.AUTHZ_OBJ_NAME (Vamsee Yarlagadda, Reviewed by: Alexander Kolbasov)
Date Sun, 03 Sep 2017 09:04:51 GMT
Repository: sentry
Updated Branches:
  refs/heads/master f0fffa279 -> e3eccaaa1


SENTRY-1913: Incorrect constraints on AUTHZ_PATHS_MAPPING.AUTHZ_OBJ_NAME
(Vamsee Yarlagadda, Reviewed by: Alexander Kolbasov)


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

Branch: refs/heads/master
Commit: e3eccaaa140977517df035ab90fc6c7754444cfe
Parents: f0fffa2
Author: Vamsee Yarlagadda <vamsee@cloudera.com>
Authored: Fri Sep 1 15:20:53 2017 -0700
Committer: Vamsee Yarlagadda <vamsee@cloudera.com>
Committed: Sun Sep 3 02:04:28 2017 -0700

----------------------------------------------------------------------
 .../org/apache/sentry/provider/db/service/model/package.jdo   | 7 +++++--
 .../src/main/resources/007-SENTRY-1365.derby.sql              | 4 ++--
 .../src/main/resources/007-SENTRY-1365.mysql.sql              | 2 +-
 .../src/main/resources/007-SENTRY-1365.oracle.sql             | 4 ++--
 .../src/main/resources/007-SENTRY-1365.postgres.sql           | 4 ++--
 .../src/main/resources/sentry-db2-2.0.0.sql                   | 4 ++--
 .../src/main/resources/sentry-derby-2.0.0.sql                 | 4 ++--
 .../src/main/resources/sentry-mysql-2.0.0.sql                 | 4 ++--
 .../src/main/resources/sentry-oracle-2.0.0.sql                | 4 ++--
 .../src/main/resources/sentry-postgres-2.0.0.sql              | 4 ++--
 10 files changed, 22 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sentry/blob/e3eccaaa/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 59f6826..88d7378 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
@@ -247,14 +247,17 @@
        <datastore-identity>
          <column name="AUTHZ_OBJ_ID"/>
        </datastore-identity>
+       <index name="AuthzObjNameID" unique="true">
+         <field name="authzObjName"/>
+         <field name="authzSnapshotID"/>
+       </index>
        <!--
          authzObjName is composed by hive database name, and table name. e.g. "default.tb1".
Since
          both hive database name, and table name have restrictions to be at most 128 characters
long,
          384 characters length should be enough for AUTHZ_OBJ_NAM.
        -->
        <field name="authzObjName">
-         <column name="AUTHZ_OBJ_NAME" length="384" jdbc-type="VARCHAR"/>
-         <index name="AuthzObjName" unique="true"/>
+         <column name="AUTHZ_OBJ_NAME" length="384" jdbc-type="VARCHAR" allows-null="false"/>
        </field>
        <field name="createTimeMs">
          <column name="CREATE_TIME_MS" jdbc-type="BIGINT"/>

http://git-wip-us.apache.org/repos/asf/sentry/blob/e3eccaaa/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 d738230..13708ba 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
@@ -2,7 +2,7 @@
 CREATE TABLE AUTHZ_PATHS_MAPPING
 (
     AUTHZ_OBJ_ID BIGINT NOT NULL generated always as identity (start with 1),
-    AUTHZ_OBJ_NAME VARCHAR(384),
+    AUTHZ_OBJ_NAME VARCHAR(384) NOT NULL,
     CREATE_TIME_MS BIGINT NOT NULL,
     AUTHZ_SNAPSHOT_ID BIGINT NOT NULL
 );
@@ -10,7 +10,7 @@ CREATE TABLE AUTHZ_PATHS_MAPPING
 ALTER TABLE AUTHZ_PATHS_MAPPING ADD CONSTRAINT AUTHZ_PATHS_MAPPING_PK PRIMARY KEY (AUTHZ_OBJ_ID);
 
 -- Constraints for table AUTHZ_PATHS_MAPPING for class(es) [org.apache.sentry.provider.db.service.model.MAuthzPathsMapping]
-CREATE UNIQUE INDEX AUTHZOBJNAME ON AUTHZ_PATHS_MAPPING (AUTHZ_OBJ_NAME);
+CREATE UNIQUE INDEX AUTHZOBJNAMEID ON AUTHZ_PATHS_MAPPING (AUTHZ_OBJ_NAME, AUTHZ_SNAPSHOT_ID);
 
 -- Table `AUTHZ_PATH` for classes [org.apache.sentry.provider.db.service.model.MPath]
 CREATE TABLE AUTHZ_PATH

http://git-wip-us.apache.org/repos/asf/sentry/blob/e3eccaaa/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 84eac33..a7db1b7 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
@@ -9,7 +9,7 @@ CREATE TABLE `AUTHZ_PATHS_MAPPING`
 ) ENGINE=INNODB;
 
 -- Constraints for table `AUTHZ_PATHS_MAPPING` for class(es) [org.apache.sentry.provider.db.service.model.MAuthzPathsMapping]
-CREATE UNIQUE INDEX `AUTHZOBJNAME` ON `AUTHZ_PATHS_MAPPING` (`AUTHZ_OBJ_NAME`);
+CREATE UNIQUE INDEX `AUTHZOBJNAMEID` ON `AUTHZ_PATHS_MAPPING` (`AUTHZ_OBJ_NAME`, `AUTHZ_SNAPSHOT_ID`);
 
 -- Table `AUTHZ_PATH` for classes [org.apache.sentry.provider.db.service.model.MPath]
 CREATE TABLE `AUTHZ_PATH` (

http://git-wip-us.apache.org/repos/asf/sentry/blob/e3eccaaa/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 d7d9679..ebb981a 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
@@ -2,7 +2,7 @@
 CREATE TABLE AUTHZ_PATHS_MAPPING
 (
     AUTHZ_OBJ_ID NUMBER NOT NULL,
-    AUTHZ_OBJ_NAME VARCHAR2(384) NULL,
+    AUTHZ_OBJ_NAME VARCHAR2(384) NOT NULL,
     CREATE_TIME_MS NUMBER NOT NULL,
     AUTHZ_SNAPSHOT_ID NUMBER NOT NULL
 );
@@ -10,7 +10,7 @@ CREATE TABLE AUTHZ_PATHS_MAPPING
 ALTER TABLE AUTHZ_PATHS_MAPPING ADD CONSTRAINT AUTHZ_PATHS_MAPPING_PK PRIMARY KEY (AUTHZ_OBJ_ID);
 
 -- Constraints for table AUTHZ_PATHS_MAPPING for class(es) [org.apache.sentry.provider.db.service.model.MAuthzPathsMapping]
-CREATE UNIQUE INDEX AUTHZOBJNAME ON AUTHZ_PATHS_MAPPING (AUTHZ_OBJ_NAME);
+CREATE UNIQUE INDEX AUTHZOBJNAMEID ON AUTHZ_PATHS_MAPPING (AUTHZ_OBJ_NAME, AUTHZ_SNAPSHOT_ID);
 
 -- Table `AUTHZ_PATH` for classes [org.apache.sentry.provider.db.service.model.MPath]
 CREATE TABLE AUTHZ_PATH

http://git-wip-us.apache.org/repos/asf/sentry/blob/e3eccaaa/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 cf961f3..e0b560c 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
@@ -2,14 +2,14 @@
 CREATE TABLE "AUTHZ_PATHS_MAPPING"
 (
     "AUTHZ_OBJ_ID" SERIAL,
-    "AUTHZ_OBJ_NAME" varchar(384) NULL,
+    "AUTHZ_OBJ_NAME" varchar(384) NOT NULL,
     "CREATE_TIME_MS" int8 NOT NULL,
     "AUTHZ_SNAPSHOT_ID" bigint NOT NULL,
     CONSTRAINT "AUTHZ_PATHS_MAPPING_PK" PRIMARY KEY ("AUTHZ_OBJ_ID")
 );
 
 -- Constraints for table "AUTHZ_PATHS_MAPPING" for class(es) [org.apache.sentry.provider.db.service.model.MAuthzPathsMapping]
-CREATE UNIQUE INDEX "AUTHZOBJNAME" ON "AUTHZ_PATHS_MAPPING" ("AUTHZ_OBJ_NAME");
+CREATE UNIQUE INDEX "AUTHZOBJNAMEID" ON "AUTHZ_PATHS_MAPPING" ("AUTHZ_OBJ_NAME", "AUTHZ_SNAPSHOT_ID");
 
 -- Table `AUTHZ_PATH` for classes [org.apache.sentry.provider.db.service.model.MPath]
 CREATE TABLE "AUTHZ_PATH"

http://git-wip-us.apache.org/repos/asf/sentry/blob/e3eccaaa/sentry-provider/sentry-provider-db/src/main/resources/sentry-db2-2.0.0.sql
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/resources/sentry-db2-2.0.0.sql b/sentry-provider/sentry-provider-db/src/main/resources/sentry-db2-2.0.0.sql
index 93d6e70..1661412 100644
--- a/sentry-provider/sentry-provider-db/src/main/resources/sentry-db2-2.0.0.sql
+++ b/sentry-provider/sentry-provider-db/src/main/resources/sentry-db2-2.0.0.sql
@@ -194,7 +194,7 @@ ALTER TABLE AUTHZ_PATHS_SNAPSHOT_ID ADD CONSTRAINT AUTHZ_SNAPSHOT_ID_PK
PRIMARY
 -- 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),
+    AUTHZ_OBJ_NAME VARCHAR(384) NOT NULL,
     CREATE_TIME_MS BIGINT NOT NULL,
     AUTHZ_SNAPSHOT_ID BIGINT NOT NULL
 );
@@ -202,7 +202,7 @@ CREATE TABLE AUTHZ_PATHS_MAPPING(
 ALTER TABLE AUTHZ_PATHS_MAPPING ADD CONSTRAINT AUTHZ_PATHSCO7K_PK PRIMARY KEY (AUTHZ_OBJ_ID);
 
 -- Constraints for table AUTHZ_PATHS_MAPPING for class(es) [org.apache.sentry.provider.db.service.model.MAuthzPathsMapping]
-CREATE UNIQUE INDEX AUTHZOBJNAME ON AUTHZ_PATHS_MAPPING (AUTHZ_OBJ_NAME);
+CREATE UNIQUE INDEX AUTHZOBJNAMEID ON AUTHZ_PATHS_MAPPING (AUTHZ_OBJ_NAME, AUTHZ_SNAPSHOT_ID);
 
 -- Table `AUTHZ_PATH` for classes [org.apache.sentry.provider.db.service.model.MPath]
 CREATE TABLE AUTHZ_PATH

http://git-wip-us.apache.org/repos/asf/sentry/blob/e3eccaaa/sentry-provider/sentry-provider-db/src/main/resources/sentry-derby-2.0.0.sql
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/resources/sentry-derby-2.0.0.sql
b/sentry-provider/sentry-provider-db/src/main/resources/sentry-derby-2.0.0.sql
index b4e39fd..1b95622 100644
--- a/sentry-provider/sentry-provider-db/src/main/resources/sentry-derby-2.0.0.sql
+++ b/sentry-provider/sentry-provider-db/src/main/resources/sentry-derby-2.0.0.sql
@@ -194,7 +194,7 @@ ALTER TABLE AUTHZ_PATHS_SNAPSHOT_ID ADD CONSTRAINT AUTHZ_SNAPSHOT_ID_PK
PRIMARY
 CREATE TABLE AUTHZ_PATHS_MAPPING
 (
     AUTHZ_OBJ_ID BIGINT NOT NULL generated always as identity (start with 1),
-    AUTHZ_OBJ_NAME VARCHAR(384),
+    AUTHZ_OBJ_NAME VARCHAR(384) NOT NULL,
     CREATE_TIME_MS BIGINT NOT NULL,
     AUTHZ_SNAPSHOT_ID BIGINT NOT NULL
 );
@@ -202,7 +202,7 @@ CREATE TABLE AUTHZ_PATHS_MAPPING
 ALTER TABLE AUTHZ_PATHS_MAPPING ADD CONSTRAINT AUTHZ_PATHS_MAPPING_PK PRIMARY KEY (AUTHZ_OBJ_ID);
 
 -- Constraints for table AUTHZ_PATHS_MAPPING for class(es) [org.apache.sentry.provider.db.service.model.MAuthzPathsMapping]
-CREATE UNIQUE INDEX AUTHZOBJNAME ON AUTHZ_PATHS_MAPPING (AUTHZ_OBJ_NAME);
+CREATE UNIQUE INDEX AUTHZOBJNAMEID ON AUTHZ_PATHS_MAPPING (AUTHZ_OBJ_NAME, AUTHZ_SNAPSHOT_ID);
 
 -- Table `AUTHZ_PATH` for classes [org.apache.sentry.provider.db.service.model.MPath]
 CREATE TABLE AUTHZ_PATH

http://git-wip-us.apache.org/repos/asf/sentry/blob/e3eccaaa/sentry-provider/sentry-provider-db/src/main/resources/sentry-mysql-2.0.0.sql
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/resources/sentry-mysql-2.0.0.sql
b/sentry-provider/sentry-provider-db/src/main/resources/sentry-mysql-2.0.0.sql
index 4326a38..f033895 100644
--- a/sentry-provider/sentry-provider-db/src/main/resources/sentry-mysql-2.0.0.sql
+++ b/sentry-provider/sentry-provider-db/src/main/resources/sentry-mysql-2.0.0.sql
@@ -232,14 +232,14 @@ CREATE TABLE `AUTHZ_PATHS_SNAPSHOT_ID`
 CREATE TABLE `AUTHZ_PATHS_MAPPING`
 (
     `AUTHZ_OBJ_ID` BIGINT NOT NULL AUTO_INCREMENT,
-    `AUTHZ_OBJ_NAME` VARCHAR(384) BINARY NULL,
+    `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;
 
 -- Constraints for table `AUTHZ_PATHS_MAPPING` for class(es) [org.apache.sentry.provider.db.service.model.MAuthzPathsMapping]
-CREATE UNIQUE INDEX `AUTHZOBJNAME` ON `AUTHZ_PATHS_MAPPING` (`AUTHZ_OBJ_NAME`);
+CREATE UNIQUE INDEX `AUTHZOBJNAMEID` ON `AUTHZ_PATHS_MAPPING` (`AUTHZ_OBJ_NAME`, `AUTHZ_SNAPSHOT_ID`);
 
 -- Table `AUTHZ_PATH` for classes [org.apache.sentry.provider.db.service.model.MPath]
 CREATE TABLE `AUTHZ_PATH` (

http://git-wip-us.apache.org/repos/asf/sentry/blob/e3eccaaa/sentry-provider/sentry-provider-db/src/main/resources/sentry-oracle-2.0.0.sql
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/resources/sentry-oracle-2.0.0.sql
b/sentry-provider/sentry-provider-db/src/main/resources/sentry-oracle-2.0.0.sql
index 92676a5..1b5cd04 100644
--- a/sentry-provider/sentry-provider-db/src/main/resources/sentry-oracle-2.0.0.sql
+++ b/sentry-provider/sentry-provider-db/src/main/resources/sentry-oracle-2.0.0.sql
@@ -209,7 +209,7 @@ ALTER TABLE "AUTHZ_PATHS_SNAPSHOT_ID" ADD CONSTRAINT "AUTHZ_SNAPSHOT_ID_PK"
PRIM
 CREATE TABLE AUTHZ_PATHS_MAPPING
 (
     AUTHZ_OBJ_ID NUMBER NOT NULL,
-    AUTHZ_OBJ_NAME VARCHAR2(384) NULL,
+    AUTHZ_OBJ_NAME VARCHAR2(384) NOT NULL,
     CREATE_TIME_MS NUMBER NOT NULL,
     "AUTHZ_SNAPSHOT_ID" NUMBER NOT NULL
 );
@@ -217,7 +217,7 @@ CREATE TABLE AUTHZ_PATHS_MAPPING
 ALTER TABLE AUTHZ_PATHS_MAPPING ADD CONSTRAINT AUTHZ_PATHS_MAPPING_PK PRIMARY KEY (AUTHZ_OBJ_ID);
 
 -- Constraints for table AUTHZ_PATHS_MAPPING for class(es) [org.apache.sentry.provider.db.service.model.MAuthzPathsMapping]
-CREATE UNIQUE INDEX AUTHZOBJNAME ON AUTHZ_PATHS_MAPPING (AUTHZ_OBJ_NAME);
+CREATE UNIQUE INDEX AUTHZOBJNAMEID ON AUTHZ_PATHS_MAPPING (AUTHZ_OBJ_NAME, AUTHZ_SNAPSHOT_ID);
 
 -- Table `AUTHZ_PATH` for classes [org.apache.sentry.provider.db.service.model.MPath]
 CREATE TABLE AUTHZ_PATH

http://git-wip-us.apache.org/repos/asf/sentry/blob/e3eccaaa/sentry-provider/sentry-provider-db/src/main/resources/sentry-postgres-2.0.0.sql
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/resources/sentry-postgres-2.0.0.sql
b/sentry-provider/sentry-provider-db/src/main/resources/sentry-postgres-2.0.0.sql
index 05eb751..d6d222e 100644
--- a/sentry-provider/sentry-provider-db/src/main/resources/sentry-postgres-2.0.0.sql
+++ b/sentry-provider/sentry-provider-db/src/main/resources/sentry-postgres-2.0.0.sql
@@ -219,14 +219,14 @@ CREATE TABLE "AUTHZ_PATHS_SNAPSHOT_ID"
 CREATE TABLE "AUTHZ_PATHS_MAPPING"
 (
     "AUTHZ_OBJ_ID" SERIAL,
-    "AUTHZ_OBJ_NAME" varchar(384) NULL,
+    "AUTHZ_OBJ_NAME" varchar(384) NOT NULL,
     "CREATE_TIME_MS" int8 NOT NULL,
     "AUTHZ_SNAPSHOT_ID" bigint NOT NULL,
     CONSTRAINT "AUTHZ_PATHS_MAPPING_PK" PRIMARY KEY ("AUTHZ_OBJ_ID")
 );
 
 -- Constraints for table "AUTHZ_PATHS_MAPPING" for class(es) [org.apache.sentry.provider.db.service.model.MAuthzPathsMapping]
-CREATE UNIQUE INDEX "AUTHZOBJNAME" ON "AUTHZ_PATHS_MAPPING" ("AUTHZ_OBJ_NAME");
+CREATE UNIQUE INDEX "AUTHZOBJNAMEID" ON "AUTHZ_PATHS_MAPPING" ("AUTHZ_OBJ_NAME", "AUTHZ_SNAPSHOT_ID");
 
 -- Table `AUTHZ_PATH` for classes [org.apache.sentry.provider.db.service.model.MPath]
 CREATE TABLE "AUTHZ_PATH"


Mime
View raw message