Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
1.3.0
-
None
Description
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).
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