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

ASF GitHub Bot commented on ARTEMIS-2210:
-----------------------------------------

Github user franz1981 commented on a diff in the pull request:

    https://github.com/apache/activemq-artemis/pull/2478#discussion_r243843391
  
    --- Diff: 
artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingManagerImpl.java
 ---
    @@ -335,19 +335,25 @@ public void deletePageStore(final SimpleString 
storeName) throws Exception {
        }
     
        /**
    -    * stores is a ConcurrentHashMap, so we don't need to synchronize this 
method
    +    * This method creates a new store if not exist.
         */
        @Override
        public PagingStore getPageStore(final SimpleString storeName) throws 
Exception {
           if (managementAddress != null && 
storeName.startsWith(managementAddress)) {
              return null;
           }
    -      PagingStore store = stores.get(storeName);
     
    -      if (store != null) {
    -         return store;
    +      try {
    --- End diff --
    
    I think that `stores.get` is better that will be used in the fast path as 
it was before: `chm:.get` is completly lock-free, while `chm::computeIfAbsent` 
will lock on segment level ie better to fallback to `chm::computeIfAbsent` only 
if `chm::get` return `null`


> PagingStore creation is not properly synchronized
> -------------------------------------------------
>
>                 Key: ARTEMIS-2210
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-2210
>             Project: ActiveMQ Artemis
>          Issue Type: Bug
>          Components: Broker
>    Affects Versions: 2.6.3
>            Reporter: Howard Gao
>            Assignee: Howard Gao
>            Priority: Major
>             Fix For: 2.7.0, 2.6.4
>
>
> In PagingManagerImpl#getPageStore() the operations on the map 'stores'
> are not synchronzed and it's possible that more than one paging store is
> created for one address.
>  



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

Reply via email to