[jira] [Issue Comment Deleted] (SENTRY-1422) JDO deadlocks while processing grant while a background thread processes Notificationlogs

2016-10-13 Thread Colin Ma (JIRA)

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

Colin Ma updated SENTRY-1422:
-
Comment: was deleted

(was: Here are the results of testing the latest attachment
https://issues.apache.org/jira/secure/attachment/12833264/SENTRY-1422.011-sentry-ha-redesign.patch
 against sentry-ha-redesign.

{color:red}Overall:{color} -1 due to 18 errors

{color:red}ERROR:{color} mvn test exited 1
{color:red}ERROR:{color} Failed: 
org.apache.sentry.provider.db.service.thrift.TestSentryServiceWithKerberos
{color:red}ERROR:{color} Failed: 
org.apache.sentry.provider.db.service.thrift.TestActivator
{color:red}ERROR:{color} Failed: 
org.apache.sentry.provider.db.generic.service.thrift.TestAuditLogForSentryGenericService
{color:red}ERROR:{color} Failed: 
org.apache.sentry.provider.db.generic.tools.TestSentryShellSolr
{color:red}ERROR:{color} Failed: 
org.apache.sentry.provider.db.service.thrift.TestSentryServiceFailureCase
{color:red}ERROR:{color} Failed: 
org.apache.sentry.provider.db.service.thrift.TestSentryServiceMetrics
{color:red}ERROR:{color} Failed: 
org.apache.sentry.provider.db.service.thrift.TestSentryServiceImportExport
{color:red}ERROR:{color} Failed: 
org.apache.sentry.service.thrift.TestHMSFollower
{color:red}ERROR:{color} Failed: 
org.apache.sentry.service.thrift.TestHMSFollower
{color:red}ERROR:{color} Failed: 
org.apache.sentry.provider.db.service.thrift.TestSentryWebServerWithKerberos
{color:red}ERROR:{color} Failed: 
org.apache.sentry.provider.db.tools.TestSentryShellHive
{color:red}ERROR:{color} Failed: 
org.apache.sentry.provider.db.service.thrift.TestSentryServiceWithInvalidMsgSize
{color:red}ERROR:{color} Failed: 
org.apache.sentry.provider.db.service.thrift.TestSentryServiceForPoolWithKerberos
{color:red}ERROR:{color} Failed: 
org.apache.sentry.provider.db.service.thrift.TestSentryServiceIntegration
{color:red}ERROR:{color} Failed: 
org.apache.sentry.provider.db.generic.tools.TestSentryConfigToolSolr
{color:red}ERROR:{color} Failed: 
org.apache.sentry.provider.db.service.thrift.TestSentryWebServerWithoutSecurity
{color:red}ERROR:{color} Failed: 
org.apache.sentry.tests.e2e.dbprovider.TestDbPrivilegesAtFunctionScope

Console output: 
https://builds.apache.org/job/PreCommit-SENTRY-Build/2066/console

This message is automatically generated.)

> JDO deadlocks while processing grant while a background thread processes 
> Notificationlogs
> -
>
> Key: SENTRY-1422
> URL: https://issues.apache.org/jira/browse/SENTRY-1422
> Project: Sentry
>  Issue Type: Sub-task
>  Components: Hdfs Plugin
>Reporter: Sravya Tirukkovalur
>Assignee: Colin Ma
> Fix For: sentry-ha-redesign
>
> Attachments: SENTRY-1422.008-sentry-ha-redesign.patch, 
> SENTRY-1422.009-sentry-ha-redesign.patch, 
> SENTRY-1422.010-sentry-ha-redesign.patch, 
> SENTRY-1422.011-sentry-ha-redesign.patch, 
> SENTRY-1422.012-sentry-ha-redesign.patch, sentry_deadlock.png, 
> testDeadLock.patch
>
>
> As I was working on Sentry-1321. I see that test case 
> TestDbPrivilegeCleanupOnDrop#testDropObjects fails while "Granting select on 
> table" with following deadlock.
> {code}
> java.sql.SQLException: Error while processing statement: FAILED: Execution 
> Error, return code 1 from 
> org.apache.hadoop.hive.ql.exec.SentryGrantRevokeTask. Unknown error for 
> request: TAlterSentryRoleGrantPrivilegeRequest(protocol_version:2, 
> requestorUserName:admin1, roleName:select_tbl1, 
> privileges:[TSentryPrivilege(privilegeScope:TABLE, serverName:server1, 
> dbName:db_2, tableName:tb_1, URI:, action:select, createTime:1469562185573, 
> grantOption:FALSE, columnName:)]), message: Iteration request failed : SELECT 
> 'org.apache.sentry.provider.db.service.model.MSentryPrivilege' AS 
> NUCLEUS_TYPE,A1.URI,A1."ACTION",A1."COLUMN_NAME",A1.CREATE_TIME,A1.DB_NAME,A1.WITH_GRANT_OPTION,A1.PRIVILEGE_SCOPE,A1."SERVER_NAME",A1."TABLE_NAME",A1.DB_PRIVILEGE_ID
>  FROM SENTRY_ROLE_DB_PRIVILEGE_MAP A0 INNER JOIN SENTRY_DB_PRIVILEGE A1 ON 
> A0.DB_PRIVILEGE_ID = A1.DB_PRIVILEGE_ID WHERE A0.ROLE_ID = ?. Server 
> Stacktrace: javax.jdo.JDODataStoreException: Iteration request failed : 
> SELECT 'org.apache.sentry.provider.db.service.model.MSentryPrivilege' AS 
> NUCLEUS_TYPE,A1.URI,A1."ACTION",A1."COLUMN_NAME",A1.CREATE_TIME,A1.DB_NAME,A1.WITH_GRANT_OPTION,A1.PRIVILEGE_SCOPE,A1."SERVER_NAME",A1."TABLE_NAME",A1.DB_PRIVILEGE_ID
>  FROM SENTRY_ROLE_DB_PRIVILEGE_MAP A0 INNER JOIN SENTRY_DB_PRIVILEGE A1 ON 
> A0.DB_PRIVILEGE_ID = A1.DB_PRIVILEGE_ID WHERE A0.ROLE_ID = ?
>   at 
> org.datanucleus.api.jdo.NucleusJDOHelper.getJDOExceptionForNucleusException(NucleusJDOHelper.java:451)
>   at 
> org.datanucleus.api.jdo.JDOTransaction.commit(JDOTransaction.java:165)
>   at 
> 

[jira] [Updated] (SENTRY-1422) JDO deadlocks while processing grant while a background thread processes Notificationlogs

2016-10-13 Thread Colin Ma (JIRA)

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

Colin Ma updated SENTRY-1422:
-
Attachment: SENTRY-1422.012-sentry-ha-redesign.patch

> JDO deadlocks while processing grant while a background thread processes 
> Notificationlogs
> -
>
> Key: SENTRY-1422
> URL: https://issues.apache.org/jira/browse/SENTRY-1422
> Project: Sentry
>  Issue Type: Sub-task
>  Components: Hdfs Plugin
>Reporter: Sravya Tirukkovalur
>Assignee: Colin Ma
> Fix For: sentry-ha-redesign
>
> Attachments: SENTRY-1422.008-sentry-ha-redesign.patch, 
> SENTRY-1422.009-sentry-ha-redesign.patch, 
> SENTRY-1422.010-sentry-ha-redesign.patch, 
> SENTRY-1422.011-sentry-ha-redesign.patch, 
> SENTRY-1422.012-sentry-ha-redesign.patch, sentry_deadlock.png, 
> testDeadLock.patch
>
>
> As I was working on Sentry-1321. I see that test case 
> TestDbPrivilegeCleanupOnDrop#testDropObjects fails while "Granting select on 
> table" with following deadlock.
> {code}
> java.sql.SQLException: Error while processing statement: FAILED: Execution 
> Error, return code 1 from 
> org.apache.hadoop.hive.ql.exec.SentryGrantRevokeTask. Unknown error for 
> request: TAlterSentryRoleGrantPrivilegeRequest(protocol_version:2, 
> requestorUserName:admin1, roleName:select_tbl1, 
> privileges:[TSentryPrivilege(privilegeScope:TABLE, serverName:server1, 
> dbName:db_2, tableName:tb_1, URI:, action:select, createTime:1469562185573, 
> grantOption:FALSE, columnName:)]), message: Iteration request failed : SELECT 
> 'org.apache.sentry.provider.db.service.model.MSentryPrivilege' AS 
> NUCLEUS_TYPE,A1.URI,A1."ACTION",A1."COLUMN_NAME",A1.CREATE_TIME,A1.DB_NAME,A1.WITH_GRANT_OPTION,A1.PRIVILEGE_SCOPE,A1."SERVER_NAME",A1."TABLE_NAME",A1.DB_PRIVILEGE_ID
>  FROM SENTRY_ROLE_DB_PRIVILEGE_MAP A0 INNER JOIN SENTRY_DB_PRIVILEGE A1 ON 
> A0.DB_PRIVILEGE_ID = A1.DB_PRIVILEGE_ID WHERE A0.ROLE_ID = ?. Server 
> Stacktrace: javax.jdo.JDODataStoreException: Iteration request failed : 
> SELECT 'org.apache.sentry.provider.db.service.model.MSentryPrivilege' AS 
> NUCLEUS_TYPE,A1.URI,A1."ACTION",A1."COLUMN_NAME",A1.CREATE_TIME,A1.DB_NAME,A1.WITH_GRANT_OPTION,A1.PRIVILEGE_SCOPE,A1."SERVER_NAME",A1."TABLE_NAME",A1.DB_PRIVILEGE_ID
>  FROM SENTRY_ROLE_DB_PRIVILEGE_MAP A0 INNER JOIN SENTRY_DB_PRIVILEGE A1 ON 
> A0.DB_PRIVILEGE_ID = A1.DB_PRIVILEGE_ID WHERE A0.ROLE_ID = ?
>   at 
> org.datanucleus.api.jdo.NucleusJDOHelper.getJDOExceptionForNucleusException(NucleusJDOHelper.java:451)
>   at 
> org.datanucleus.api.jdo.JDOTransaction.commit(JDOTransaction.java:165)
>   at 
> org.apache.sentry.provider.db.service.persistent.SentryStore.commitTransaction(SentryStore.java:279)
>   at 
> org.apache.sentry.provider.db.service.persistent.SentryStore.commitUpdateTransaction(SentryStore.java:261)
>   at 
> org.apache.sentry.provider.db.service.persistent.SentryStore.alterSentryRoleGrantPrivileges(SentryStore.java:458)
>   at 
> org.apache.sentry.provider.db.service.thrift.SentryPolicyStoreProcessor.alter_sentry_role_grant_privilege(SentryPolicyStoreProcessor.java:261)
>   at 
> org.apache.sentry.provider.db.service.thrift.SentryPolicyService$Processor$alter_sentry_role_grant_privilege.getResult(SentryPolicyService.java:1237)
>   at 
> org.apache.sentry.provider.db.service.thrift.SentryPolicyService$Processor$alter_sentry_role_grant_privilege.getResult(SentryPolicyService.java:1222)
>   at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:39)
>   at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:39)
>   at 
> org.apache.sentry.provider.db.service.thrift.SentryProcessorWrapper.process(SentryProcessorWrapper.java:35)
>   at 
> org.apache.thrift.TMultiplexedProcessor.process(TMultiplexedProcessor.java:123)
>   at 
> org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:286)
>   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:
> java.sql.SQLTransactionRollbackException: A lock could not be obtained due to 
> a deadlock, cycle of locks and waiters is:
> Lock : ROW, SENTRY_ROLE_DB_PRIVILEGE_MAP, (1,10)
>   Waiting XID : {712, S} , SENTRY, SELECT 
> 'org.apache.sentry.provider.db.service.model.MSentryPrivilege' AS 
> NUCLEUS_TYPE,A1.URI,A1."ACTION",A1."COLUMN_NAME",A1.CREATE_TIME,A1.DB_NAME,A1.WITH_GRANT_OPTION,A1.PRIVILEGE_SCOPE,A1."SERVER_NAME",A1."TABLE_NAME",A1.DB_PRIVILEGE_ID
>  FROM SENTRY_ROLE_DB_PRIVILEGE_MAP A0 INNER JOIN SENTRY_DB_PRIVILEGE A1 ON 
> A0.DB_PRIVILEGE_ID = A1.DB_PRIVILEGE_ID WHERE 

[jira] [Commented] (SENTRY-1422) JDO deadlocks while processing grant while a background thread processes Notificationlogs

2016-10-13 Thread Hadoop QA (JIRA)

[ 
https://issues.apache.org/jira/browse/SENTRY-1422?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15574135#comment-15574135
 ] 

Hadoop QA commented on SENTRY-1422:
---

Here are the results of testing the latest attachment
https://issues.apache.org/jira/secure/attachment/12833264/SENTRY-1422.011-sentry-ha-redesign.patch
 against sentry-ha-redesign.

{color:red}Overall:{color} -1 due to 18 errors

{color:red}ERROR:{color} mvn test exited 1
{color:red}ERROR:{color} Failed: 
org.apache.sentry.provider.db.service.thrift.TestSentryServiceWithKerberos
{color:red}ERROR:{color} Failed: 
org.apache.sentry.provider.db.service.thrift.TestActivator
{color:red}ERROR:{color} Failed: 
org.apache.sentry.provider.db.generic.service.thrift.TestAuditLogForSentryGenericService
{color:red}ERROR:{color} Failed: 
org.apache.sentry.provider.db.generic.tools.TestSentryShellSolr
{color:red}ERROR:{color} Failed: 
org.apache.sentry.provider.db.service.thrift.TestSentryServiceFailureCase
{color:red}ERROR:{color} Failed: 
org.apache.sentry.provider.db.service.thrift.TestSentryServiceMetrics
{color:red}ERROR:{color} Failed: 
org.apache.sentry.provider.db.service.thrift.TestSentryServiceImportExport
{color:red}ERROR:{color} Failed: 
org.apache.sentry.service.thrift.TestHMSFollower
{color:red}ERROR:{color} Failed: 
org.apache.sentry.service.thrift.TestHMSFollower
{color:red}ERROR:{color} Failed: 
org.apache.sentry.provider.db.service.thrift.TestSentryWebServerWithKerberos
{color:red}ERROR:{color} Failed: 
org.apache.sentry.provider.db.tools.TestSentryShellHive
{color:red}ERROR:{color} Failed: 
org.apache.sentry.provider.db.service.thrift.TestSentryServiceWithInvalidMsgSize
{color:red}ERROR:{color} Failed: 
org.apache.sentry.provider.db.service.thrift.TestSentryServiceForPoolWithKerberos
{color:red}ERROR:{color} Failed: 
org.apache.sentry.provider.db.service.thrift.TestSentryServiceIntegration
{color:red}ERROR:{color} Failed: 
org.apache.sentry.provider.db.generic.tools.TestSentryConfigToolSolr
{color:red}ERROR:{color} Failed: 
org.apache.sentry.provider.db.service.thrift.TestSentryWebServerWithoutSecurity
{color:red}ERROR:{color} Failed: 
org.apache.sentry.tests.e2e.dbprovider.TestDbPrivilegesAtFunctionScope

Console output: 
https://builds.apache.org/job/PreCommit-SENTRY-Build/2066/console

This message is automatically generated.

> JDO deadlocks while processing grant while a background thread processes 
> Notificationlogs
> -
>
> Key: SENTRY-1422
> URL: https://issues.apache.org/jira/browse/SENTRY-1422
> Project: Sentry
>  Issue Type: Sub-task
>  Components: Hdfs Plugin
>Reporter: Sravya Tirukkovalur
>Assignee: Colin Ma
> Fix For: sentry-ha-redesign
>
> Attachments: SENTRY-1422.008-sentry-ha-redesign.patch, 
> SENTRY-1422.009-sentry-ha-redesign.patch, 
> SENTRY-1422.010-sentry-ha-redesign.patch, 
> SENTRY-1422.011-sentry-ha-redesign.patch, sentry_deadlock.png, 
> testDeadLock.patch
>
>
> As I was working on Sentry-1321. I see that test case 
> TestDbPrivilegeCleanupOnDrop#testDropObjects fails while "Granting select on 
> table" with following deadlock.
> {code}
> java.sql.SQLException: Error while processing statement: FAILED: Execution 
> Error, return code 1 from 
> org.apache.hadoop.hive.ql.exec.SentryGrantRevokeTask. Unknown error for 
> request: TAlterSentryRoleGrantPrivilegeRequest(protocol_version:2, 
> requestorUserName:admin1, roleName:select_tbl1, 
> privileges:[TSentryPrivilege(privilegeScope:TABLE, serverName:server1, 
> dbName:db_2, tableName:tb_1, URI:, action:select, createTime:1469562185573, 
> grantOption:FALSE, columnName:)]), message: Iteration request failed : SELECT 
> 'org.apache.sentry.provider.db.service.model.MSentryPrivilege' AS 
> NUCLEUS_TYPE,A1.URI,A1."ACTION",A1."COLUMN_NAME",A1.CREATE_TIME,A1.DB_NAME,A1.WITH_GRANT_OPTION,A1.PRIVILEGE_SCOPE,A1."SERVER_NAME",A1."TABLE_NAME",A1.DB_PRIVILEGE_ID
>  FROM SENTRY_ROLE_DB_PRIVILEGE_MAP A0 INNER JOIN SENTRY_DB_PRIVILEGE A1 ON 
> A0.DB_PRIVILEGE_ID = A1.DB_PRIVILEGE_ID WHERE A0.ROLE_ID = ?. Server 
> Stacktrace: javax.jdo.JDODataStoreException: Iteration request failed : 
> SELECT 'org.apache.sentry.provider.db.service.model.MSentryPrivilege' AS 
> NUCLEUS_TYPE,A1.URI,A1."ACTION",A1."COLUMN_NAME",A1.CREATE_TIME,A1.DB_NAME,A1.WITH_GRANT_OPTION,A1.PRIVILEGE_SCOPE,A1."SERVER_NAME",A1."TABLE_NAME",A1.DB_PRIVILEGE_ID
>  FROM SENTRY_ROLE_DB_PRIVILEGE_MAP A0 INNER JOIN SENTRY_DB_PRIVILEGE A1 ON 
> A0.DB_PRIVILEGE_ID = A1.DB_PRIVILEGE_ID WHERE A0.ROLE_ID = ?
>   at 
> org.datanucleus.api.jdo.NucleusJDOHelper.getJDOExceptionForNucleusException(NucleusJDOHelper.java:451)
>   at 
> org.datanucleus.api.jdo.JDOTransaction.commit(JDOTransaction.java:165)
>   at 
> 

[jira] [Commented] (SENTRY-1422) JDO deadlocks while processing grant while a background thread processes Notificationlogs

2016-10-13 Thread Colin Ma (JIRA)

[ 
https://issues.apache.org/jira/browse/SENTRY-1422?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15573949#comment-15573949
 ] 

Colin Ma commented on SENTRY-1422:
--

[~akolb], because the deadlock is happened when grant/revoke different 
privileges for the same role,  currently, there are 2 solutions in my mind to 
resolve this problem. One is retry mechanism for transaction (the patch is 
already attached), and the other is add java lock manually to restrict only one 
role can be grant/revoke at a time, for example:
{code}
get lock for roleName
lock roleName
do transaction
unlock roleName
{code}
which one do you prefer, thanks.

> JDO deadlocks while processing grant while a background thread processes 
> Notificationlogs
> -
>
> Key: SENTRY-1422
> URL: https://issues.apache.org/jira/browse/SENTRY-1422
> Project: Sentry
>  Issue Type: Sub-task
>  Components: Hdfs Plugin
>Reporter: Sravya Tirukkovalur
>Assignee: Colin Ma
> Fix For: sentry-ha-redesign
>
> Attachments: SENTRY-1422.008-sentry-ha-redesign.patch, 
> SENTRY-1422.009-sentry-ha-redesign.patch, 
> SENTRY-1422.010-sentry-ha-redesign.patch, 
> SENTRY-1422.011-sentry-ha-redesign.patch, sentry_deadlock.png, 
> testDeadLock.patch
>
>
> As I was working on Sentry-1321. I see that test case 
> TestDbPrivilegeCleanupOnDrop#testDropObjects fails while "Granting select on 
> table" with following deadlock.
> {code}
> java.sql.SQLException: Error while processing statement: FAILED: Execution 
> Error, return code 1 from 
> org.apache.hadoop.hive.ql.exec.SentryGrantRevokeTask. Unknown error for 
> request: TAlterSentryRoleGrantPrivilegeRequest(protocol_version:2, 
> requestorUserName:admin1, roleName:select_tbl1, 
> privileges:[TSentryPrivilege(privilegeScope:TABLE, serverName:server1, 
> dbName:db_2, tableName:tb_1, URI:, action:select, createTime:1469562185573, 
> grantOption:FALSE, columnName:)]), message: Iteration request failed : SELECT 
> 'org.apache.sentry.provider.db.service.model.MSentryPrivilege' AS 
> NUCLEUS_TYPE,A1.URI,A1."ACTION",A1."COLUMN_NAME",A1.CREATE_TIME,A1.DB_NAME,A1.WITH_GRANT_OPTION,A1.PRIVILEGE_SCOPE,A1."SERVER_NAME",A1."TABLE_NAME",A1.DB_PRIVILEGE_ID
>  FROM SENTRY_ROLE_DB_PRIVILEGE_MAP A0 INNER JOIN SENTRY_DB_PRIVILEGE A1 ON 
> A0.DB_PRIVILEGE_ID = A1.DB_PRIVILEGE_ID WHERE A0.ROLE_ID = ?. Server 
> Stacktrace: javax.jdo.JDODataStoreException: Iteration request failed : 
> SELECT 'org.apache.sentry.provider.db.service.model.MSentryPrivilege' AS 
> NUCLEUS_TYPE,A1.URI,A1."ACTION",A1."COLUMN_NAME",A1.CREATE_TIME,A1.DB_NAME,A1.WITH_GRANT_OPTION,A1.PRIVILEGE_SCOPE,A1."SERVER_NAME",A1."TABLE_NAME",A1.DB_PRIVILEGE_ID
>  FROM SENTRY_ROLE_DB_PRIVILEGE_MAP A0 INNER JOIN SENTRY_DB_PRIVILEGE A1 ON 
> A0.DB_PRIVILEGE_ID = A1.DB_PRIVILEGE_ID WHERE A0.ROLE_ID = ?
>   at 
> org.datanucleus.api.jdo.NucleusJDOHelper.getJDOExceptionForNucleusException(NucleusJDOHelper.java:451)
>   at 
> org.datanucleus.api.jdo.JDOTransaction.commit(JDOTransaction.java:165)
>   at 
> org.apache.sentry.provider.db.service.persistent.SentryStore.commitTransaction(SentryStore.java:279)
>   at 
> org.apache.sentry.provider.db.service.persistent.SentryStore.commitUpdateTransaction(SentryStore.java:261)
>   at 
> org.apache.sentry.provider.db.service.persistent.SentryStore.alterSentryRoleGrantPrivileges(SentryStore.java:458)
>   at 
> org.apache.sentry.provider.db.service.thrift.SentryPolicyStoreProcessor.alter_sentry_role_grant_privilege(SentryPolicyStoreProcessor.java:261)
>   at 
> org.apache.sentry.provider.db.service.thrift.SentryPolicyService$Processor$alter_sentry_role_grant_privilege.getResult(SentryPolicyService.java:1237)
>   at 
> org.apache.sentry.provider.db.service.thrift.SentryPolicyService$Processor$alter_sentry_role_grant_privilege.getResult(SentryPolicyService.java:1222)
>   at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:39)
>   at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:39)
>   at 
> org.apache.sentry.provider.db.service.thrift.SentryProcessorWrapper.process(SentryProcessorWrapper.java:35)
>   at 
> org.apache.thrift.TMultiplexedProcessor.process(TMultiplexedProcessor.java:123)
>   at 
> org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:286)
>   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:
> java.sql.SQLTransactionRollbackException: A lock could not be obtained due to 
> a deadlock, cycle of locks and waiters is:
> Lock : ROW, SENTRY_ROLE_DB_PRIVILEGE_MAP, (1,10)
>  

[jira] [Created] (SENTRY-1503) Remove all sequence ID checks from TestSentryStore

2016-10-13 Thread Alexander Kolbasov (JIRA)
Alexander Kolbasov created SENTRY-1503:
--

 Summary: Remove all sequence ID checks from TestSentryStore
 Key: SENTRY-1503
 URL: https://issues.apache.org/jira/browse/SENTRY-1503
 Project: Sentry
  Issue Type: Test
  Components: Sentry
Affects Versions: 1.7.0, sentry-ha-redesign
Reporter: Alexander Kolbasov


TestSentryStore shouldn't assert or otherwise check sequence IDs in its tests - 
sequence ID is not a functional interface and are, in fact, meaningless.



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


[jira] [Updated] (SENTRY-1422) JDO deadlocks while processing grant while a background thread processes Notificationlogs

2016-10-13 Thread Colin Ma (JIRA)

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

Colin Ma updated SENTRY-1422:
-
Attachment: SENTRY-1422.011-sentry-ha-redesign.patch

Update patch with the retry mechanism for SentryStore.

> JDO deadlocks while processing grant while a background thread processes 
> Notificationlogs
> -
>
> Key: SENTRY-1422
> URL: https://issues.apache.org/jira/browse/SENTRY-1422
> Project: Sentry
>  Issue Type: Sub-task
>  Components: Hdfs Plugin
>Reporter: Sravya Tirukkovalur
>Assignee: Colin Ma
> Fix For: sentry-ha-redesign
>
> Attachments: SENTRY-1422.008-sentry-ha-redesign.patch, 
> SENTRY-1422.009-sentry-ha-redesign.patch, 
> SENTRY-1422.010-sentry-ha-redesign.patch, 
> SENTRY-1422.011-sentry-ha-redesign.patch, sentry_deadlock.png, 
> testDeadLock.patch
>
>
> As I was working on Sentry-1321. I see that test case 
> TestDbPrivilegeCleanupOnDrop#testDropObjects fails while "Granting select on 
> table" with following deadlock.
> {code}
> java.sql.SQLException: Error while processing statement: FAILED: Execution 
> Error, return code 1 from 
> org.apache.hadoop.hive.ql.exec.SentryGrantRevokeTask. Unknown error for 
> request: TAlterSentryRoleGrantPrivilegeRequest(protocol_version:2, 
> requestorUserName:admin1, roleName:select_tbl1, 
> privileges:[TSentryPrivilege(privilegeScope:TABLE, serverName:server1, 
> dbName:db_2, tableName:tb_1, URI:, action:select, createTime:1469562185573, 
> grantOption:FALSE, columnName:)]), message: Iteration request failed : SELECT 
> 'org.apache.sentry.provider.db.service.model.MSentryPrivilege' AS 
> NUCLEUS_TYPE,A1.URI,A1."ACTION",A1."COLUMN_NAME",A1.CREATE_TIME,A1.DB_NAME,A1.WITH_GRANT_OPTION,A1.PRIVILEGE_SCOPE,A1."SERVER_NAME",A1."TABLE_NAME",A1.DB_PRIVILEGE_ID
>  FROM SENTRY_ROLE_DB_PRIVILEGE_MAP A0 INNER JOIN SENTRY_DB_PRIVILEGE A1 ON 
> A0.DB_PRIVILEGE_ID = A1.DB_PRIVILEGE_ID WHERE A0.ROLE_ID = ?. Server 
> Stacktrace: javax.jdo.JDODataStoreException: Iteration request failed : 
> SELECT 'org.apache.sentry.provider.db.service.model.MSentryPrivilege' AS 
> NUCLEUS_TYPE,A1.URI,A1."ACTION",A1."COLUMN_NAME",A1.CREATE_TIME,A1.DB_NAME,A1.WITH_GRANT_OPTION,A1.PRIVILEGE_SCOPE,A1."SERVER_NAME",A1."TABLE_NAME",A1.DB_PRIVILEGE_ID
>  FROM SENTRY_ROLE_DB_PRIVILEGE_MAP A0 INNER JOIN SENTRY_DB_PRIVILEGE A1 ON 
> A0.DB_PRIVILEGE_ID = A1.DB_PRIVILEGE_ID WHERE A0.ROLE_ID = ?
>   at 
> org.datanucleus.api.jdo.NucleusJDOHelper.getJDOExceptionForNucleusException(NucleusJDOHelper.java:451)
>   at 
> org.datanucleus.api.jdo.JDOTransaction.commit(JDOTransaction.java:165)
>   at 
> org.apache.sentry.provider.db.service.persistent.SentryStore.commitTransaction(SentryStore.java:279)
>   at 
> org.apache.sentry.provider.db.service.persistent.SentryStore.commitUpdateTransaction(SentryStore.java:261)
>   at 
> org.apache.sentry.provider.db.service.persistent.SentryStore.alterSentryRoleGrantPrivileges(SentryStore.java:458)
>   at 
> org.apache.sentry.provider.db.service.thrift.SentryPolicyStoreProcessor.alter_sentry_role_grant_privilege(SentryPolicyStoreProcessor.java:261)
>   at 
> org.apache.sentry.provider.db.service.thrift.SentryPolicyService$Processor$alter_sentry_role_grant_privilege.getResult(SentryPolicyService.java:1237)
>   at 
> org.apache.sentry.provider.db.service.thrift.SentryPolicyService$Processor$alter_sentry_role_grant_privilege.getResult(SentryPolicyService.java:1222)
>   at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:39)
>   at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:39)
>   at 
> org.apache.sentry.provider.db.service.thrift.SentryProcessorWrapper.process(SentryProcessorWrapper.java:35)
>   at 
> org.apache.thrift.TMultiplexedProcessor.process(TMultiplexedProcessor.java:123)
>   at 
> org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:286)
>   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:
> java.sql.SQLTransactionRollbackException: A lock could not be obtained due to 
> a deadlock, cycle of locks and waiters is:
> Lock : ROW, SENTRY_ROLE_DB_PRIVILEGE_MAP, (1,10)
>   Waiting XID : {712, S} , SENTRY, SELECT 
> 'org.apache.sentry.provider.db.service.model.MSentryPrivilege' AS 
> NUCLEUS_TYPE,A1.URI,A1."ACTION",A1."COLUMN_NAME",A1.CREATE_TIME,A1.DB_NAME,A1.WITH_GRANT_OPTION,A1.PRIVILEGE_SCOPE,A1."SERVER_NAME",A1."TABLE_NAME",A1.DB_PRIVILEGE_ID
>  FROM SENTRY_ROLE_DB_PRIVILEGE_MAP A0 INNER JOIN SENTRY_DB_PRIVILEGE A1 ON 
> A0.DB_PRIVILEGE_ID = 

[jira] [Commented] (SENTRY-1486) Sentry should use repeatable-read consistency level

2016-10-13 Thread Alexander Kolbasov (JIRA)

[ 
https://issues.apache.org/jira/browse/SENTRY-1486?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15573339#comment-15573339
 ] 

Alexander Kolbasov commented on SENTRY-1486:


In Oracle classification "serializable" is the "repeatable reads" in MySQL. I 
looked at the DB drivers in Datanucleus - they assume that Oracle support 
repeatable reads, so they don't distinguish. They have a logic to move to a 
higher level if a specific one isn't supported, so it would work correctly if 
they don't mark repeatable-read as supported by Oracle. This means that we 
can't rely on DN to do the right thing and should figure out how to make a 
different setting for Oracle.

> Sentry should use repeatable-read consistency level
> ---
>
> Key: SENTRY-1486
> URL: https://issues.apache.org/jira/browse/SENTRY-1486
> Project: Sentry
>  Issue Type: Bug
>  Components: Sentry
>Affects Versions: 1.7.0, sentry-ha-redesign
>Reporter: Alexander Kolbasov
>Assignee: Alexander Kolbasov
> Fix For: 1.8.0
>
> Attachments: SENTRY-1486.001.patch, SENTRY-1486.002.patch
>
>
> Currently Sentry uses the "read-committed" consistency level which is the 
> default for the Datanucleus JDO library. This causes potential problems since 
> the state visible to each transaction can actually see updates from another 
> transactions, so it is very difficult to reason about any code that reads 
> multiple pieces of data.
> Instead it should use repeatable read" consistency which guarantees that any 
> transaction only sees the state at the beginning of a transaction plus any 
> updates done within a transaction.



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


[jira] [Commented] (SENTRY-1486) Sentry should use repeatable-read consistency level

2016-10-13 Thread Sravya Tirukkovalur (JIRA)

[ 
https://issues.apache.org/jira/browse/SENTRY-1486?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15573127#comment-15573127
 ] 

Sravya Tirukkovalur commented on SENTRY-1486:
-

Seems like Oracle does not support repeatable-read.

Caused by: javax.jdo.JDODataStoreException: READ_COMMITTED and SERIALIZABLE are 
the only valid transaction levels

> Sentry should use repeatable-read consistency level
> ---
>
> Key: SENTRY-1486
> URL: https://issues.apache.org/jira/browse/SENTRY-1486
> Project: Sentry
>  Issue Type: Bug
>  Components: Sentry
>Affects Versions: 1.7.0, sentry-ha-redesign
>Reporter: Alexander Kolbasov
>Assignee: Alexander Kolbasov
> Fix For: 1.8.0
>
> Attachments: SENTRY-1486.001.patch, SENTRY-1486.002.patch
>
>
> Currently Sentry uses the "read-committed" consistency level which is the 
> default for the Datanucleus JDO library. This causes potential problems since 
> the state visible to each transaction can actually see updates from another 
> transactions, so it is very difficult to reason about any code that reads 
> multiple pieces of data.
> Instead it should use repeatable read" consistency which guarantees that any 
> transaction only sees the state at the beginning of a transaction plus any 
> updates done within a transaction.



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