Uploaded image for project: 'Sentry'
  1. Sentry
  2. SENTRY-181

Add a test case for duplicate privileges

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.3.0
    • Fix Version/s: 1.4.0
    • Component/s: None
    • Labels:

      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 
      

        Attachments

        1. SENTRY-181.patch
          2 kB
          Jarek Jarcec Cecho
        2. SENTRY-181.patch
          2 kB
          Jarek Jarcec Cecho
        3. SENTRY-181.patch
          2 kB
          Jarek Jarcec Cecho

          Activity

            People

            • Assignee:
              jarcec Jarek Jarcec Cecho
              Reporter:
              lskuff Lenni Kuff
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: