You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@sentry.apache.org by "Jan Hentschel (JIRA)" <ji...@apache.org> on 2016/11/13 11:05:58 UTC

[jira] [Commented] (SENTRY-1501) SentryStore shouldn't synchronize openTransaction() and commitUpdateTransaction()

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

Jan Hentschel commented on SENTRY-1501:
---------------------------------------

Is this still an issues? As far as I see, the mentioned code was removed as part of SENTRY-1205 and SENTRY-1512.

> SentryStore shouldn't synchronize openTransaction() and commitUpdateTransaction()
> ---------------------------------------------------------------------------------
>
>                 Key: SENTRY-1501
>                 URL: https://issues.apache.org/jira/browse/SENTRY-1501
>             Project: Sentry
>          Issue Type: Improvement
>          Components: Sentry
>    Affects Versions: 1.7.0, sentry-ha-redesign
>            Reporter: Alexander Kolbasov
>
> SentryStore.openTransaction() is synchronized for no reason - the peristence manager factory is thread-safe. 
> The synchronization here doesn't make any sense at all:
> {code}
>   /**
>    * Synchronized due to sequence id generation
>    */
>   public synchronized CommitContext commitUpdateTransaction(PersistenceManager pm) {
>     commitTransaction(pm);
>     return new CommitContext(SERVER_UUID, incrementGetSequenceId());
>   }
>   /**
>    * Increments commitSequenceId which should not be modified outside
>    * this method.
>    *
>    * @return sequence id
>    */
>   private synchronized long incrementGetSequenceId() {
>     return ++commitSequenceId;
>   }
> {code}
> Note that incrementGetSequenceId() is synchronized so there is no need to synchronize commitUpdateTransaction(). More over, there is no need to synchronize incrementGetSequenceId(), it can just use atomic for the index. And I think that handling of this atomic should be moved to the CommitContext instead.



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