Chao Sun created SENTRY-935:
-------------------------------

             Summary: duplicate key value violates unique constraint 
"PRIVILEGE_INDEX"
                 Key: SENTRY-935
                 URL: https://issues.apache.org/jira/browse/SENTRY-935
             Project: Sentry
          Issue Type: Bug
            Reporter: Chao Sun
             Fix For: 1.5.1


In our test jenkins job, we would drop and recreate a "test_role" every time 
the job runs. In the first few runs there's no issue. However, recently this 
happened:

{code}
06:12:50 +++ set +e
06:12:50 +++ impala-shell.sh -q 'DROP ROLE TEST_ROLE'
06:12:51 Starting Impala Shell without Kerberos authentication
06:12:51 Connected to localhost.localdomain:21000
06:12:51 Server version: impalad version 0.2.0-cdh5 DEBUG (build 
90d65dedb26fbd49bc49134ec11c440fdff3f122)
06:12:51 Query: drop ROLE TEST_ROLE
06:12:51 +++ set -e
06:12:51 +++ impala-shell.sh -q 'CREATE ROLE TEST_ROLE'
06:12:51 Starting Impala Shell without Kerberos authentication
06:12:51 Connected to localhost.localdomain:21000
06:12:51 Server version: impalad version 0.2.0-cdh5 DEBUG (build 
90d65dedb26fbd49bc49134ec11c440fdff3f122)
06:12:51 Query: create ROLE TEST_ROLE
06:12:51 
06:12:51 Fetched 0 row(s) in 0.13s
06:12:51 +++ impala-shell.sh -q 'GRANT ALL ON SERVER TO ROLE TEST_ROLE'
06:12:52 Starting Impala Shell without Kerberos authentication
06:12:52 Connected to localhost.localdomain:21000
06:12:52 Server version: impalad version 0.2.0-cdh5 DEBUG (build 
90d65dedb26fbd49bc49134ec11c440fdff3f122)
06:12:52 Query: grant ALL ON SERVER TO ROLE TEST_ROLE
06:12:52 ERROR: 
06:12:52 RuntimeException: Unknown error for request: 
TAlterSentryRoleGrantPrivilegeRequest(protocol_version:2, 
requestorUserName:jenkins, roleName:TEST_ROLE, 
privileges:[TSentryPrivilege(privilegeScope:SERVER, serverName:server1, 
dbName:, tableName:, URI:, action:*, createTime:1445951572120, 
grantOption:FALSE, columnName:)]), message: Insert of object 
"org.apache.sentry.provider.db.service.model.MSentryPrivilege@3553d094" using 
statement "INSERT INTO "SENTRY_DB_PRIVILEGE" 
("DB_PRIVILEGE_ID","TABLE_NAME","CREATE_TIME","PRIVILEGE_SCOPE","URI","SERVER_NAME","COLUMN_NAME","WITH_GRANT_OPTION","DB_NAME","ACTION")
 VALUES (?,?,?,?,?,?,?,?,?,?)" failed : ERROR: duplicate key value violates 
unique constraint "PRIVILEGE_INDEX". Server Stacktrace: 
javax.jdo.JDODataStoreException: Insert of object 
"org.apache.sentry.provider.db.service.model.MSentryPrivilege@3553d094" using 
statement "INSERT INTO "SENTRY_DB_PRIVILEGE" 
("DB_PRIVILEGE_ID","TABLE_NAME","CREATE_TIME","PRIVILEGE_SCOPE","URI","SERVER_NAME","COLUMN_NAME","WITH_GRANT_OPTION","DB_NAME","ACTION")
 VALUES (?,?,?,?,?,?,?,?,?,?)" failed : ERROR: duplicate key value violates 
unique constraint "PRIVILEGE_INDEX"
06:12:52        at 
org.datanucleus.api.jdo.NucleusJDOHelper.getJDOExceptionForNucleusException(NucleusJDOHelper.java:451)
06:12:52        at 
org.datanucleus.api.jdo.JDOPersistenceManager.jdoMakePersistent(JDOPersistenceManager.java:732)
06:12:52        at 
org.datanucleus.api.jdo.JDOPersistenceManager.makePersistent(JDOPersistenceManager.java:752)
06:12:52        at 
org.apache.sentry.provider.db.service.persistent.SentryStore.alterSentryRoleGrantPrivilegeCore(SentryStore.java:481)
06:12:52        at 
org.apache.sentry.provider.db.service.persistent.SentryStore.alterSentryRoleGrantPrivileges(SentryStore.java:418)
06:12:52        at 
org.apache.sentry.provider.db.service.thrift.SentryPolicyStoreProcessor.alter_sentry_role_grant_privilege(SentryPolicyStoreProcessor.java:273)
06:12:52        at 
org.apache.sentry.provider.db.service.thrift.SentryPolicyService$Processor$alter_sentry_role_grant_privilege.getResult(SentryPolicyService.java:933)
06:12:52        at 
org.apache.sentry.provider.db.service.thrift.SentryPolicyService$Processor$alter_sentry_role_grant_privilege.getResult(SentryPolicyService.java:918)
06:12:52        at 
org.apache.thrift.ProcessFunction.process(ProcessFunction.java:39)
06:12:52        at 
org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:39)
06:12:52        at 
org.apache.sentry.provider.db.service.thrift.SentryProcessorWrapper.process(SentryProcessorWrapper.java:35)
06:12:52        at 
org.apache.thrift.TMultiplexedProcessor.process(TMultiplexedProcessor.java:123)
06:12:52        at 
org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:285)
06:12:52        at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
06:12:52        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
06:12:52        at java.lang.Thread.run(Thread.java:745)
06:12:52 NestedThrowablesStackTrace:
06:12:52 org.postgresql.util.PSQLException: ERROR: duplicate key value violates 
unique constraint "PRIVILEGE_INDEX"
06:12:52        at 
org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2102)
06:12:52        at 
org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1835)
06:12:52        at 
org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
{code}

Not sure why this happens. I do found a page that explains what this error 
means: http://hcmc.uvic.ca/blogs/index.php?blog=22&p=8105&more=1&c=1&tb=1&pb=1



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to