> On Sept. 8, 2017, 6:05 a.m., Alexander Kolbasov wrote:
> > sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/package.jdo
> > Line 122 (original)
> > <https://reviews.apache.org/r/61793/diff/4/?file=1813351#file1813351line122>
> >
> >     This change makes package.jdo inconsistent with sql scripts which do 
> > use these fields as keys and the goal was to make these consistent.

The data type and size in package.jdo should be one-to-one mapping to what's in 
sql.
The index defined in package.jdo is inserted into DB, and the index defined in 
SQL is also inserted into DB. So the index in package.jdo is not one-to-one 
mapping to index in sql. In my opinion, we should only keep the index in sql.

when I issue mysql command: "show crete table SENTRY_DB_PRIVILEGE;", the table 
SENTRY_DB_PRIVILEGE contains two unique index: `PRIVILEGE_INDEX` from 
datanucleus package.jdo, and `SENTRY_DB_PRIV_PRIV_NAME_UNIQ` from sql script 
(like sentry-mysql-2.0.0.sql). Should we just keep one unique index for this 
table?
SENTRY_DB_PRIVILEGE     CREATE TABLE `SENTRY_DB_PRIVILEGE` (
`DB_PRIVILEGE_ID` bigint(20) NOT NULL,
`PRIVILEGE_SCOPE` varchar(32) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`SERVER_NAME` varchar(128) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`DB_NAME` varchar(128) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT '_NULL_',
`TABLE_NAME` varchar(128) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT '_NULL_',
`COLUMN_NAME` varchar(128) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT '_NULL_',
`URI` varchar(4000) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT '_NULL_',
`ACTION` varchar(128) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`CREATE_TIME` bigint(20) NOT NULL,
`WITH_GRANT_OPTION` char(1) NOT NULL,
PRIMARY KEY (`DB_PRIVILEGE_ID`),
UNIQUE KEY `PRIVILEGE_INDEX` 
(`SERVER_NAME`,`DB_NAME`,`TABLE_NAME`,`COLUMN_NAME`,`ACTION`,`WITH_GRANT_OPTION`),
UNIQUE KEY `SENTRY_DB_PRIV_PRIV_NAME_UNIQ` 
(`SERVER_NAME`,`DB_NAME`,`TABLE_NAME`,`COLUMN_NAME`,`URI`(250),`ACTION`,`WITH_GRANT_OPTION`),
KEY `SENTRY_PRIV_SERV_IDX` (`SERVER_NAME`),
KEY `SENTRY_PRIV_DB_IDX` (`DB_NAME`),
KEY `SENTRY_PRIV_TBL_IDX` (`TABLE_NAME`),
KEY `SENTRY_PRIV_COL_IDX` (`COLUMN_NAME`),
KEY `SENTRY_PRIV_URI_IDX` (`URI`(255))
) ENGINE=InnoDB DEFAULT CHARSET=utf8


- Na


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/61793/#review184946
-----------------------------------------------------------


On Sept. 1, 2017, 9:53 p.m., Na Li wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/61793/
> -----------------------------------------------------------
> 
> (Updated Sept. 1, 2017, 9:53 p.m.)
> 
> 
> Review request for sentry, Alexander Kolbasov, Sergio Pena, and Vamsee 
> Yarlagadda.
> 
> 
> Repository: sentry
> 
> 
> Description
> -------
> 
> reduce field size `SERVER_NAME`,`DB_NAME`,`TABLE_NAME`,`COLUMN_NAME` in 
> `SENTRY_DB_PRIVILEGE` from 4000 to 128, and remove `URI` from being part of 
> the unique id
> 
> 
> Diffs
> -----
> 
>   
> sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/package.jdo
>  734ea7f 
> 
> 
> Diff: https://reviews.apache.org/r/61793/diff/4/
> 
> 
> Testing
> -------
> 
> run datanucleus schema tool. Without this change, it complains 
> "com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Specified key was 
> too long; max key length is 767 bytes. 
>  After those change, the datanucleus schema tool finishes successfully with 
> command "mvn datanucleus:schema-create -X -e"
> 
> 
> Thanks,
> 
> Na Li
> 
>

Reply via email to