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

Arun Suresh resolved SENTRY-210.
--------------------------------

    Resolution: Fixed

> Exception Thrown When Trying to grantRoleToGroup
> ------------------------------------------------
>
>                 Key: SENTRY-210
>                 URL: https://issues.apache.org/jira/browse/SENTRY-210
>             Project: Sentry
>          Issue Type: Bug
>    Affects Versions: db_policy_store, 1.4.0
>            Reporter: Arun Suresh
>
> This is tested on a MySql backend store.. would probably manifest similarly 
> on postgres and oracle
> Steps to recreate (Using the thrift RPC client):
> 1) Create role : 
> sentryClient.createRole(granter, granterGroups, adminRole);
> 2) Call the grantRoteToGroup API :
> sentryClient.grantRoleToGroup(granter, granterGroups, "testGroup", 
> adminRole); 
> This leads to the folioing Exception :
> {quote}
> Exception in thread "main" java.lang.RuntimeException: Unknown error for 
> request: TAlterSentryRoleAddGroupsRequest(protocol_version:1, 
> requestorUserName:admin, requestorGroupNames:[admin], roleName:adminRole0, 
> groups:[TSentryGroup(groupName:testGroup0)]), message: One or more instances 
> could not be made persistent. Server Stacktrace: javax.jdo.JDOUserException: 
> One or more instances could not be made persistent
>       at 
> org.datanucleus.api.jdo.JDOPersistenceManager.makePersistentAll(JDOPersistenceManager.java:787)
>       at 
> org.apache.sentry.provider.db.service.persistent.SentryStore.alterSentryRoleAddGroups(SentryStore.java:505)
>       at 
> org.apache.sentry.provider.db.service.thrift.SentryPolicyStoreProcessor.alter_sentry_role_add_groups(SentryPolicyStoreProcessor.java:249)
>       at 
> org.apache.sentry.provider.db.service.thrift.SentryPolicyService$Processor$alter_sentry_role_add_groups.getResult(SentryPolicyService.java:733)
>       at 
> org.apache.sentry.provider.db.service.thrift.SentryPolicyService$Processor$alter_sentry_role_add_groups.getResult(SentryPolicyService.java:718)
>       at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:39)
>       at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:39)
>       at 
> org.apache.thrift.TMultiplexedProcessor.process(TMultiplexedProcessor.java:123)
>       at 
> org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:244)
>       at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>       at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>       at java.lang.Thread.run(Thread.java:745)
> NestedThrowablesStackTrace:
> Add request failed : INSERT INTO `SENTRY_ROLE_GROUP_MAP` 
> (`GROUP_ID`,`ROLE_ID`) VALUES (?,?)
> org.datanucleus.exceptions.NucleusDataStoreException: Add request failed : 
> INSERT INTO `SENTRY_ROLE_GROUP_MAP` (`GROUP_ID`,`ROLE_ID`) VALUES (?,?)
>       at 
> org.datanucleus.store.rdbms.scostore.JoinSetStore.addAll(JoinSetStore.java:470)
>       at 
> org.datanucleus.store.rdbms.mapping.java.CollectionMapping.postInsert(CollectionMapping.java:136)
>       at 
> org.datanucleus.store.rdbms.request.InsertRequest.execute(InsertRequest.java:518)
>       at 
> org.datanucleus.store.rdbms.RDBMSPersistenceHandler.insertTable(RDBMSPersistenceHandler.java:167)
>       at 
> org.datanucleus.store.rdbms.RDBMSPersistenceHandler.insertObject(RDBMSPersistenceHandler.java:143)
>       at 
> org.datanucleus.state.JDOStateManager.internalMakePersistent(JDOStateManager.java:3777)
>       at 
> org.datanucleus.state.JDOStateManager.makePersistent(JDOStateManager.java:3753)
>       at 
> org.datanucleus.ExecutionContextImpl.persistObjectInternal(ExecutionContextImpl.java:2124)
>       at 
> org.datanucleus.ExecutionContextImpl.persistObjectWork(ExecutionContextImpl.java:1972)
>       at 
> org.datanucleus.ExecutionContextImpl.persistObjects(ExecutionContextImpl.java:1912)
>       at 
> org.datanucleus.ExecutionContextThreadedImpl.persistObjects(ExecutionContextThreadedImpl.java:231)
>       at 
> org.datanucleus.api.jdo.JDOPersistenceManager.makePersistentAll(JDOPersistenceManager.java:776)
>       at 
> org.apache.sentry.provider.db.service.persistent.SentryStore.alterSentryRoleAddGroups(SentryStore.java:505)
>       at 
> org.apache.sentry.provider.db.service.thrift.SentryPolicyStoreProcessor.alter_sentry_role_add_groups(SentryPolicyStoreProcessor.java:249)
>       at 
> org.apache.sentry.provider.db.service.thrift.SentryPolicyService$Processor$alter_sentry_role_add_groups.getResult(SentryPolicyService.java:733)
>       at 
> org.apache.sentry.provider.db.service.thrift.SentryPolicyService$Processor$alter_sentry_role_add_groups.getResult(SentryPolicyService.java:718)
>       at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:39)
>       at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:39)
>       at 
> org.apache.thrift.TMultiplexedProcessor.process(TMultiplexedProcessor.java:123)
>       at 
> org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:244)
>       at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>       at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>       at java.lang.Thread.run(Thread.java:745)
> Caused by: org.datanucleus.store.rdbms.exceptions.MappedDatastoreException: 
> INSERT INTO `SENTRY_ROLE_GROUP_MAP` (`GROUP_ID`,`ROLE_ID`) VALUES (?,?)
>       at 
> org.datanucleus.store.rdbms.scostore.JoinSetStore.doInternalAdd(JoinSetStore.java:753)
>       at 
> org.datanucleus.store.rdbms.scostore.JoinSetStore.internalAdd(JoinSetStore.java:501)
>       at 
> org.datanucleus.store.rdbms.scostore.JoinSetStore.addAll(JoinSetStore.java:432)
>       ... 22 more
> Caused by: java.sql.SQLException: Field 'ROLE_GROUP_MAP_ID' doesn't have a 
> default value
>       at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1075)
>       at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3562)
>       at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3494)
>       at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1960)
>       at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2114)
>       at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2696)
>       at 
> com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2105)
>       at 
> com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2398)
>       at 
> com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2316)
>       at 
> com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2301)
>       at 
> com.jolbox.bonecp.PreparedStatementHandle.executeUpdate(PreparedStatementHandle.java:203)
>       at 
> org.datanucleus.store.rdbms.ParamLoggingPreparedStatement.executeUpdate(ParamLoggingPreparedStatement.java:399)
>       at 
> org.datanucleus.store.rdbms.SQLController.executeStatementUpdate(SQLController.java:439)
>       at 
> org.datanucleus.store.rdbms.scostore.JoinSetStore.doInternalAdd(JoinSetStore.java:732)
>       ... 24 more
> Nested Throwables StackTrace:
> org.datanucleus.store.rdbms.exceptions.MappedDatastoreException: INSERT INTO 
> `SENTRY_ROLE_GROUP_MAP` (`GROUP_ID`,`ROLE_ID`) VALUES (?,?)
>       at 
> org.datanucleus.store.rdbms.scostore.JoinSetStore.doInternalAdd(JoinSetStore.java:753)
>       at 
> org.datanucleus.store.rdbms.scostore.JoinSetStore.internalAdd(JoinSetStore.java:501)
>       at 
> org.datanucleus.store.rdbms.scostore.JoinSetStore.addAll(JoinSetStore.java:432)
>       at 
> org.datanucleus.store.rdbms.mapping.java.CollectionMapping.postInsert(CollectionMapping.java:136)
>       at 
> org.datanucleus.store.rdbms.request.InsertRequest.execute(InsertRequest.java:518)
>       at 
> org.datanucleus.store.rdbms.RDBMSPersistenceHandler.insertTable(RDBMSPersistenceHandler.java:167)
>       at 
> org.datanucleus.store.rdbms.RDBMSPersistenceHandler.insertObject(RDBMSPersistenceHandler.java:143)
>       at 
> org.datanucleus.state.JDOStateManager.internalMakePersistent(JDOStateManager.java:3777)
>       at 
> org.datanucleus.state.JDOStateManager.makePersistent(JDOStateManager.java:3753)
>       at 
> org.datanucleus.ExecutionContextImpl.persistObjectInternal(ExecutionContextImpl.java:2124)
>       at 
> org.datanucleus.ExecutionContextImpl.persistObjectWork(ExecutionContextImpl.java:1972)
>       at 
> org.datanucleus.ExecutionContextImpl.persistObjects(ExecutionContextImpl.java:1912)
>       at 
> org.datanucleus.ExecutionContextThreadedImpl.persistObjects(ExecutionContextThreadedImpl.java:231)
>       at 
> org.datanucleus.api.jdo.JDOPersistenceManager.makePersistentAll(JDOPersistenceManager.java:776)
>       at 
> org.apache.sentry.provider.db.service.persistent.SentryStore.alterSentryRoleAddGroups(SentryStore.java:505)
>       at 
> org.apache.sentry.provider.db.service.thrift.SentryPolicyStoreProcessor.alter_sentry_role_add_groups(SentryPolicyStoreProcessor.java:249)
>       at 
> org.apache.sentry.provider.db.service.thrift.SentryPolicyService$Processor$alter_sentry_role_add_groups.getResult(SentryPolicyService.java:733)
>       at 
> org.apache.sentry.provider.db.service.thrift.SentryPolicyService$Processor$alter_sentry_role_add_groups.getResult(SentryPolicyService.java:718)
>       at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:39)
>       at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:39)
>       at 
> org.apache.thrift.TMultiplexedProcessor.process(TMultiplexedProcessor.java:123)
>       at 
> org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:244)
>       at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>       at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>       at java.lang.Thread.run(Thread.java:745)
> Caused by: java.sql.SQLException: Field 'ROLE_GROUP_MAP_ID' doesn't have a 
> default value
>       at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1075)
>       at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3562)
>       at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3494)
>       at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1960)
>       at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2114)
>       at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2696)
>       at 
> com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2105)
>       at 
> com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2398)
>       at 
> com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2316)
>       at 
> com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2301)
>       at 
> com.jolbox.bonecp.PreparedStatementHandle.executeUpdate(PreparedStatementHandle.java:203)
>       at 
> org.datanucleus.store.rdbms.ParamLoggingPreparedStatement.executeUpdate(ParamLoggingPreparedStatement.java:399)
>       at 
> org.datanucleus.store.rdbms.SQLController.executeStatementUpdate(SQLController.java:439)
>       at 
> org.datanucleus.store.rdbms.scostore.JoinSetStore.doInternalAdd(JoinSetStore.java:732)
>       ... 24 more
>       at org.apache.sentry.service.thrift.Status.throwIfNotOk(Status.java:104)
>       at 
> org.apache.sentry.provider.db.service.thrift.SentryPolicyServiceClient.grantRoleToGroup(SentryPolicyServiceClient.java:339)
>       at 
> org.apache.sentry.provider.db.tools.SentrySchemaTool.stressTest(SentrySchemaTool.java:460)
>       at 
> org.apache.sentry.provider.db.tools.SentrySchemaTool$CommandImpl.run(SentrySchemaTool.java:653)
>       at org.apache.sentry.SentryMain.main(SentryMain.java:72)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>       at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>       at java.lang.reflect.Method.invoke(Method.java:606)
>       at org.apache.hadoop.util.RunJar.main(RunJar.java:212)
> {quote}



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

Reply via email to