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

Na Li commented on SENTRY-2483:
-------------------------------

The cause of failure is not related to this code change. It is testing code 
calling schema creation twice. 

The log of failed test case shows deadlock when both Sentry server instances 
are started. The related log messages are below. It seems derby DB (used in e2e 
test) could get into deadlock if 
1) thread_1 gets shared lock
2) thread_2 gets shared lock
3) thread_1 tries to get execution lock, and wait for execution lock because 
thread_2 got shared lock already. 
4) thread_2 tries to get execution lock, and wait for execution lock because 
thread_1 got shared lock already. 


{code}
2019-01-04 18:32:46,332 (pool-13-thread-1) [INFO - 
org.apache.sentry.hdfs.DBUpdateForwarder.getAllUpdatesFrom(DBUpdateForwarder.java:140)]
 (org.apache.sentry.hdfs.PermImageRetriever) Requested sequence number 0 is 
less than 0 or requested deltas for that sequence number are not available. 
Fetch a full update
2019-01-04 18:32:49,346 (hms-follower) [DEBUG - 
org.apache.sentry.service.thrift.SentryStateBank.enableState(SentryStateBank.java:102)]
 HMSFollower entered state STARTED
2019-01-04 18:32:50,091 (hms-follower) [DEBUG - 
org.apache.sentry.service.thrift.SentryStateBank.enableState(SentryStateBank.java:102)]
 HMSFollower entered state STARTED
2019-01-04 18:33:00,286 (store-cleaner) [ERROR - 
org.datanucleus.util.Log4JLogger.error(Log4JLogger.java:115)] Error thrown 
executing CREATE TABLE SENTRY_HMS_NOTIFICATION_ID
(
    NOTIFICATION_ID BIGINT NOT NULL
) : A lock could not be obtained due to a deadlock, cycle of locks and waiters 
is:
Lock : ROW, SYSTABLES, (1,3)
  Waiting XID : {436, X} , SENTRY, CREATE TABLE SENTRY_HMS_NOTIFICATION_ID
(
    NOTIFICATION_ID BIGINT NOT NULL
)
  Granted XID : {419, S} 
Lock : ROW, SYSTABLES, (1,3)
  Waiting XID : {419, X} , SENTRY, CREATE TABLE SENTRY_HMS_NOTIFICATION_ID
(
    NOTIFICATION_ID BIGINT NOT NULL
)
  Granted XID : {419, S} , {436, S} 
. The selected victim is XID : 436.
java.sql.SQLTransactionRollbackException: A lock could not be obtained due to a 
deadlock, cycle of locks and waiters is:
Lock : ROW, SYSTABLES, (1,3)
  Waiting XID : {436, X} , SENTRY, CREATE TABLE SENTRY_HMS_NOTIFICATION_ID
(
    NOTIFICATION_ID BIGINT NOT NULL
)
  Granted XID : {419, S} 
Lock : ROW, SYSTABLES, (1,3)
  Waiting XID : {419, X} , SENTRY, CREATE TABLE SENTRY_HMS_NOTIFICATION_ID
(
    NOTIFICATION_ID BIGINT NOT NULL
)
  Granted XID : {419, S} , {436, S} 
. The selected victim is XID : 436.
        at 
org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
        at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown 
Source)
        at 
org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown 
Source)
        at 
org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown 
Source)
        at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown 
Source)
        at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown 
Source)
        at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown 
Source)
        at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
        at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
        at com.jolbox.bonecp.StatementHandle.execute(StatementHandle.java:254)
        at 
org.datanucleus.store.rdbms.table.AbstractTable.executeDdlStatement(AbstractTable.java:879)
        at 
org.datanucleus.store.rdbms.table.AbstractTable.executeDdlStatementList(AbstractTable.java:830)
        at 
org.datanucleus.store.rdbms.table.AbstractTable.create(AbstractTable.java:546)
        at 
org.datanucleus.store.rdbms.table.AbstractTable.exists(AbstractTable.java:609)
        at 
org.datanucleus.store.rdbms.RDBMSStoreManager$ClassAdder.performTablesValidation(RDBMSStoreManager.java:3385)
        at 
org.datanucleus.store.rdbms.RDBMSStoreManager$ClassAdder.run(RDBMSStoreManager.java:2896)
        at 
org.datanucleus.store.rdbms.AbstractSchemaTransaction.execute(AbstractSchemaTransaction.java:119)
        at 
...[truncated 36339941 chars]...
eImpl(RetryClientInvocationHandler.java:94)] Calling getAllUpdatesFrom
{code}

> Implement HMS PreReadEvent support in MetastoreAuthzBinding
> -----------------------------------------------------------
>
>                 Key: SENTRY-2483
>                 URL: https://issues.apache.org/jira/browse/SENTRY-2483
>             Project: Sentry
>          Issue Type: Improvement
>          Components: Sentry
>            Reporter: Sergio Peña
>            Assignee: Sergio Peña
>            Priority: Major
>         Attachments: SENTRY-2483.1.patch, SENTRY-2483.2.patch, Test failure 
> log for TestHDFSIntegrationWithHA in patch in SENTRY-2483.2.patch.txt
>
>
> MetastoreAuthzBinding has support for all HMS DDL events to verify if a user 
> has the authorization to execute them. However, read event, such as 
> READ_DATABASE and READ_TABLE are not supported.
> We should add support for them so HMS can have read authorization checks too.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to