[ 
https://issues.apache.org/jira/browse/SENTRY-181?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Sravya Tirukkovalur updated SENTRY-181:
---------------------------------------

    Summary: Add a test case for duplicate privileges  (was: Improve error 
handling of duplicate privileges on same object in Sentry Policy Service)

> Add a test case for duplicate privileges
> ----------------------------------------
>
>                 Key: SENTRY-181
>                 URL: https://issues.apache.org/jira/browse/SENTRY-181
>             Project: Sentry
>          Issue Type: Bug
>    Affects Versions: 1.3.0
>            Reporter: Lenni Kuff
>            Assignee: Jarek Jarcec Cecho
>              Labels: grant/revoke
>             Fix For: 1.4.0
>
>         Attachments: SENTRY-181.patch
>
>
> The error I get when the same privilege is added twice to a role is not very 
> user friendly. I feel that this case should probably not even be an error (if 
> the privilege already exists just return with Status OK).
> {code}
> java.lang.RuntimeException: Unknown error for request: 
> TAlterSentryRoleGrantPrivilegeRequest(protocol_version:1, 
> requestorUserName:lskuff, requestorGroupNames:[lskuff], 
> roleName:insert_functional_alltypes, 
> privilege:TSentryPrivilege(privilegeScope:TABLE, serverName:server1, 
> dbName:alltypes, tableName:functional, action:INSERT, 
> createTime:1398272883261, grantorPrincipal:lskuff)), message: Insert of 
> object 
> "org.apache.sentry.provider.db.service.model.MSentryPrivilege@6c4fb761" using 
> statement "INSERT INTO "SENTRY_DB_PRIVILEGE" 
> ("DB_PRIVILEGE_ID","CREATE_TIME","URI","ACTION","TABLE_NAME","DB_NAME","GRANTOR_PRINCIPAL","PRIVILEGE_SCOPE","PRIVILEGE_NAME","SERVER_NAME")
>  VALUES (?,?,?,?,?,?,?,?,?,?)" failed : ERROR: duplicate key value violates 
> unique constraint "SENTRY_PRIVILEGE_NAME"
>   Detail: Key ("PRIVILEGE_NAME")=(server1+alltypes+functional+INSERT) already 
> exists.. Server Stacktrace: javax.jdo.JDODataStoreException: Insert of object 
> "org.apache.sentry.provider.db.service.model.MSentryPrivilege@6c4fb761" using 
> statement "INSERT INTO "SENTRY_DB_PRIVILEGE" 
> ("DB_PRIVILEGE_ID","CREATE_TIME","URI","ACTION","TABLE_NAME","DB_NAME","GRANTOR_PRINCIPAL","PRIVILEGE_SCOPE","PRIVILEGE_NAME","SERVER_NAME")
>  VALUES (?,?,?,?,?,?,?,?,?,?)" failed : ERROR: duplicate key value violates 
> unique constraint "SENTRY_PRIVILEGE_NAME"
>   Detail: Key ("PRIVILEGE_NAME")=(server1+alltypes+functional+INSERT) already 
> exists.
>       at 
> org.datanucleus.api.jdo.NucleusJDOHelper.getJDOExceptionForNucleusException(NucleusJDOHelper.java:451)
>       at 
> org.datanucleus.api.jdo.JDOPersistenceManager.jdoMakePersistent(JDOPersistenceManager.java:732)
>       at 
> org.datanucleus.api.jdo.JDOPersistenceManager.makePersistent(JDOPersistenceManager.java:752)
>       at 
> {code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to