You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sentry.apache.org by li...@apache.org on 2018/04/30 18:52:40 UTC

sentry git commit: SENTRY-2210: AUTHZ_PATH should have index on the foreign key AUTHZ_OBJ_ID

Repository: sentry
Updated Branches:
  refs/heads/master 6752f14aa -> 6e78a486f


SENTRY-2210: AUTHZ_PATH should have index on the foreign key AUTHZ_OBJ_ID


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

Branch: refs/heads/master
Commit: 6e78a486f18fcca9dbc26baee9bc15c4d71ebeec
Parents: 6752f14
Author: lina.li <li...@cloudera.com>
Authored: Mon Apr 30 13:51:25 2018 -0500
Committer: lina.li <li...@cloudera.com>
Committed: Mon Apr 30 13:51:25 2018 -0500

----------------------------------------------------------------------
 .../src/main/resources/010-SENTRY-2210.derby.sql                 | 3 +++
 .../src/main/resources/010-SENTRY-2210.mysql.sql                 | 2 ++
 .../src/main/resources/010-SENTRY-2210.oracle.sql                | 2 ++
 .../src/main/resources/010-SENTRY-2210.postgres.sql              | 2 ++
 .../sentry-provider-db/src/main/resources/sentry-db2-2.1.0.sql   | 2 ++
 .../sentry-provider-db/src/main/resources/sentry-derby-2.1.0.sql | 2 ++
 .../sentry-provider-db/src/main/resources/sentry-mysql-2.1.0.sql | 2 ++
 .../src/main/resources/sentry-oracle-2.1.0.sql                   | 2 ++
 .../src/main/resources/sentry-postgres-2.1.0.sql                 | 2 ++
 .../src/main/resources/sentry-upgrade-db2-2.0.0-to-2.1.0.sql     | 4 ++++
 .../src/main/resources/sentry-upgrade-derby-2.0.0-to-2.1.0.sql   | 1 +
 .../src/main/resources/sentry-upgrade-mysql-2.0.0-to-2.1.0.sql   | 1 +
 .../src/main/resources/sentry-upgrade-oracle-2.0.0-to-2.1.0.sql  | 2 +-
 .../main/resources/sentry-upgrade-postgres-2.0.0-to-2.1.0.sql    | 2 +-
 14 files changed, 27 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sentry/blob/6e78a486/sentry-provider/sentry-provider-db/src/main/resources/010-SENTRY-2210.derby.sql
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/resources/010-SENTRY-2210.derby.sql b/sentry-provider/sentry-provider-db/src/main/resources/010-SENTRY-2210.derby.sql
new file mode 100644
index 0000000..5c55090
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/main/resources/010-SENTRY-2210.derby.sql
@@ -0,0 +1,3 @@
+-- create index for foreign key AUTHZ_OBJ_ID
+CREATE INDEX AUTHZ_PATH_FK_IDX ON AUTHZ_PATH (AUTHZ_OBJ_ID);
+

http://git-wip-us.apache.org/repos/asf/sentry/blob/6e78a486/sentry-provider/sentry-provider-db/src/main/resources/010-SENTRY-2210.mysql.sql
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/resources/010-SENTRY-2210.mysql.sql b/sentry-provider/sentry-provider-db/src/main/resources/010-SENTRY-2210.mysql.sql
new file mode 100644
index 0000000..48c929e
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/main/resources/010-SENTRY-2210.mysql.sql
@@ -0,0 +1,2 @@
+-- create index for foreign key AUTHZ_OBJ_ID
+CREATE INDEX `AUTHZ_PATH_FK_IDX` ON `AUTHZ_PATH` (`AUTHZ_OBJ_ID`);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/sentry/blob/6e78a486/sentry-provider/sentry-provider-db/src/main/resources/010-SENTRY-2210.oracle.sql
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/resources/010-SENTRY-2210.oracle.sql b/sentry-provider/sentry-provider-db/src/main/resources/010-SENTRY-2210.oracle.sql
new file mode 100644
index 0000000..3fa60bb
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/main/resources/010-SENTRY-2210.oracle.sql
@@ -0,0 +1,2 @@
+-- create index for foreign key AUTHZ_OBJ_ID
+CREATE INDEX "AUTHZ_PATH_FK_IDX" ON "AUTHZ_PATH" ("AUTHZ_OBJ_ID");
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/sentry/blob/6e78a486/sentry-provider/sentry-provider-db/src/main/resources/010-SENTRY-2210.postgres.sql
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/resources/010-SENTRY-2210.postgres.sql b/sentry-provider/sentry-provider-db/src/main/resources/010-SENTRY-2210.postgres.sql
new file mode 100644
index 0000000..cdc2ff7
--- /dev/null
+++ b/sentry-provider/sentry-provider-db/src/main/resources/010-SENTRY-2210.postgres.sql
@@ -0,0 +1,2 @@
+-- create index for foreign key AUTHZ_OBJ_ID
+CREATE INDEX "AUTHZ_PATH_FK_IDX" ON "AUTHZ_PATH" USING btree ("AUTHZ_OBJ_ID");
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/sentry/blob/6e78a486/sentry-provider/sentry-provider-db/src/main/resources/sentry-db2-2.1.0.sql
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/resources/sentry-db2-2.1.0.sql b/sentry-provider/sentry-provider-db/src/main/resources/sentry-db2-2.1.0.sql
index ca20a39..5e36ee3 100644
--- a/sentry-provider/sentry-provider-db/src/main/resources/sentry-db2-2.1.0.sql
+++ b/sentry-provider/sentry-provider-db/src/main/resources/sentry-db2-2.1.0.sql
@@ -220,6 +220,8 @@ ALTER TABLE AUTHZ_PATH
   ADD CONSTRAINT AUTHZ_PATH_FK
   FOREIGN KEY (AUTHZ_OBJ_ID) REFERENCES AUTHZ_PATHS_MAPPING (AUTHZ_OBJ_ID);
 
+CREATE INDEX AUTHZ_PATH_FK_IDX ON AUTHZ_PATH (AUTHZ_OBJ_ID);
+
 -- Table SENTRY_PERM_CHANGE for classes [org.apache.sentry.provider.db.service.model.MSentryPermChange]
 CREATE TABLE SENTRY_PERM_CHANGE
 (

http://git-wip-us.apache.org/repos/asf/sentry/blob/6e78a486/sentry-provider/sentry-provider-db/src/main/resources/sentry-derby-2.1.0.sql
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/resources/sentry-derby-2.1.0.sql b/sentry-provider/sentry-provider-db/src/main/resources/sentry-derby-2.1.0.sql
index 70acb89..374d59e 100644
--- a/sentry-provider/sentry-provider-db/src/main/resources/sentry-derby-2.1.0.sql
+++ b/sentry-provider/sentry-provider-db/src/main/resources/sentry-derby-2.1.0.sql
@@ -220,6 +220,8 @@ ALTER TABLE AUTHZ_PATH
   ADD CONSTRAINT AUTHZ_PATH_FK
   FOREIGN KEY (AUTHZ_OBJ_ID) REFERENCES AUTHZ_PATHS_MAPPING (AUTHZ_OBJ_ID);
 
+CREATE INDEX AUTHZ_PATH_FK_IDX ON AUTHZ_PATH (AUTHZ_OBJ_ID);
+
 -- Table SENTRY_PERM_CHANGE for classes [org.apache.sentry.provider.db.service.model.MSentryPermChange]
 CREATE TABLE SENTRY_PERM_CHANGE
 (

http://git-wip-us.apache.org/repos/asf/sentry/blob/6e78a486/sentry-provider/sentry-provider-db/src/main/resources/sentry-mysql-2.1.0.sql
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/resources/sentry-mysql-2.1.0.sql b/sentry-provider/sentry-provider-db/src/main/resources/sentry-mysql-2.1.0.sql
index eb175bd..8876872 100644
--- a/sentry-provider/sentry-provider-db/src/main/resources/sentry-mysql-2.1.0.sql
+++ b/sentry-provider/sentry-provider-db/src/main/resources/sentry-mysql-2.1.0.sql
@@ -256,6 +256,8 @@ ALTER TABLE `AUTHZ_PATH`
   ADD CONSTRAINT `AUTHZ_PATH_FK`
   FOREIGN KEY (`AUTHZ_OBJ_ID`) REFERENCES `AUTHZ_PATHS_MAPPING`(`AUTHZ_OBJ_ID`);
 
+CREATE INDEX `AUTHZ_PATH_FK_IDX` ON `AUTHZ_PATH` (`AUTHZ_OBJ_ID`);
+
 -- Table `SENTRY_PERM_CHANGE` for classes [org.apache.sentry.provider.db.service.model.MSentryPermChange]
 CREATE TABLE `SENTRY_PERM_CHANGE`
 (

http://git-wip-us.apache.org/repos/asf/sentry/blob/6e78a486/sentry-provider/sentry-provider-db/src/main/resources/sentry-oracle-2.1.0.sql
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/resources/sentry-oracle-2.1.0.sql b/sentry-provider/sentry-provider-db/src/main/resources/sentry-oracle-2.1.0.sql
index e6dbf91..46d3fc8 100644
--- a/sentry-provider/sentry-provider-db/src/main/resources/sentry-oracle-2.1.0.sql
+++ b/sentry-provider/sentry-provider-db/src/main/resources/sentry-oracle-2.1.0.sql
@@ -235,6 +235,8 @@ ALTER TABLE AUTHZ_PATH
   ADD CONSTRAINT AUTHZ_PATH_FK
   FOREIGN KEY (AUTHZ_OBJ_ID) REFERENCES AUTHZ_PATHS_MAPPING (AUTHZ_OBJ_ID);
 
+CREATE INDEX "AUTHZ_PATH_FK_IDX" ON "AUTHZ_PATH" ("AUTHZ_OBJ_ID");
+
 -- Table "SENTRY_PERM_CHANGE" for classes [org.apache.sentry.provider.db.service.model.MSentryPermChange]
 CREATE TABLE "SENTRY_PERM_CHANGE"
 (

http://git-wip-us.apache.org/repos/asf/sentry/blob/6e78a486/sentry-provider/sentry-provider-db/src/main/resources/sentry-postgres-2.1.0.sql
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/resources/sentry-postgres-2.1.0.sql b/sentry-provider/sentry-provider-db/src/main/resources/sentry-postgres-2.1.0.sql
index 989301b..c28dd9f 100644
--- a/sentry-provider/sentry-provider-db/src/main/resources/sentry-postgres-2.1.0.sql
+++ b/sentry-provider/sentry-provider-db/src/main/resources/sentry-postgres-2.1.0.sql
@@ -244,6 +244,8 @@ ALTER TABLE "AUTHZ_PATH"
   ADD CONSTRAINT "AUTHZ_PATH_FK"
   FOREIGN KEY ("AUTHZ_OBJ_ID") REFERENCES "AUTHZ_PATHS_MAPPING" ("AUTHZ_OBJ_ID") DEFERRABLE;
 
+CREATE INDEX "AUTHZ_PATH_FK_IDX" ON "AUTHZ_PATH" USING btree ("AUTHZ_OBJ_ID");
+
 -- Table `SENTRY_PERM_CHANGE` for classes [org.apache.sentry.provider.db.service.model.MSentryPermChange]
 CREATE TABLE "SENTRY_PERM_CHANGE"
 (

http://git-wip-us.apache.org/repos/asf/sentry/blob/6e78a486/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-db2-2.0.0-to-2.1.0.sql
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-db2-2.0.0-to-2.1.0.sql b/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-db2-2.0.0-to-2.1.0.sql
index aca05bc..3e0373d 100644
--- a/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-db2-2.0.0-to-2.1.0.sql
+++ b/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-db2-2.0.0-to-2.1.0.sql
@@ -1,2 +1,6 @@
+-- create index for foreign key AUTHZ_OBJ_ID
+CREATE INDEX AUTHZ_PATH_FK_IDX ON AUTHZ_PATH (AUTHZ_OBJ_ID);
+
 -- Version update
 UPDATE SENTRY_VERSION SET SCHEMA_VERSION='2.1.0', VERSION_COMMENT='Sentry release version 2.1.0' WHERE VER_ID=1;
+

http://git-wip-us.apache.org/repos/asf/sentry/blob/6e78a486/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-derby-2.0.0-to-2.1.0.sql
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-derby-2.0.0-to-2.1.0.sql b/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-derby-2.0.0-to-2.1.0.sql
index a3c87bd..5640b76 100644
--- a/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-derby-2.0.0-to-2.1.0.sql
+++ b/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-derby-2.0.0-to-2.1.0.sql
@@ -1,3 +1,4 @@
+RUN '010-SENTRY-2210.derby.sql';
 
 -- Version update
 UPDATE SENTRY_VERSION SET SCHEMA_VERSION='2.1.0', VERSION_COMMENT='Sentry release version 2.1.0' WHERE VER_ID=1;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/sentry/blob/6e78a486/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-mysql-2.0.0-to-2.1.0.sql
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-mysql-2.0.0-to-2.1.0.sql b/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-mysql-2.0.0-to-2.1.0.sql
index cce5c7c..350bc48 100644
--- a/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-mysql-2.0.0-to-2.1.0.sql
+++ b/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-mysql-2.0.0-to-2.1.0.sql
@@ -1,4 +1,5 @@
 SELECT 'Upgrading Sentry store schema from 2.0.0 to 2.1.0' AS ' ';
+SOURCE 010-SENTRY-2210.mysql.sql;
 
 UPDATE SENTRY_VERSION SET SCHEMA_VERSION='2.1.0', VERSION_COMMENT='Sentry release version 2.1.0' WHERE VER_ID=1;
 

http://git-wip-us.apache.org/repos/asf/sentry/blob/6e78a486/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-oracle-2.0.0-to-2.1.0.sql
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-oracle-2.0.0-to-2.1.0.sql b/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-oracle-2.0.0-to-2.1.0.sql
index 169cd4d..3afd788 100644
--- a/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-oracle-2.0.0-to-2.1.0.sql
+++ b/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-oracle-2.0.0-to-2.1.0.sql
@@ -1,5 +1,5 @@
 SELECT 'Upgrading Sentry store schema from 2.0.0 to 2.1.0' AS Status from dual;
-
+@010-SENTRY-2210.oracle.sql;
 
 UPDATE SENTRY_VERSION SET SCHEMA_VERSION='2.1.0', VERSION_COMMENT='Sentry release version 2.1.0' WHERE VER_ID=1;
 

http://git-wip-us.apache.org/repos/asf/sentry/blob/6e78a486/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-postgres-2.0.0-to-2.1.0.sql
----------------------------------------------------------------------
diff --git a/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-postgres-2.0.0-to-2.1.0.sql b/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-postgres-2.0.0-to-2.1.0.sql
index 986389b..13df239 100644
--- a/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-postgres-2.0.0-to-2.1.0.sql
+++ b/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-postgres-2.0.0-to-2.1.0.sql
@@ -1,5 +1,5 @@
 SELECT 'Upgrading Sentry store schema from 2.0.0 to 2.1.0';
-
+\i 010-SENTRY-2210.postgres.sql;
 
 UPDATE "SENTRY_VERSION" SET "SCHEMA_VERSION"='2.1.0', "VERSION_COMMENT"='Sentry release version 2.1.0' WHERE "VER_ID"=1;