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

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

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

    https://github.com/apache/activemq-artemis/pull/2369#discussion_r224977450
  
    --- Diff: 
artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageCursorProviderImpl.java
 ---
    @@ -599,6 +600,29 @@ private long checkMinPage(Collection<PageSubscription> 
cursorList) {
     
        }
     
    +   private void deliverIfNecessary(Collection<PageSubscription> 
cursorList) {
    +      long minPage = Long.MAX_VALUE;
    +      PageSubscription slowSubscription = null;
    +      int nonEmptyCursorNum = 0;
    +
    +      for (PageSubscription cursor : cursorList) {
    +         long firstPage = cursor.getFirstPage();
    +
    +         // the cursor will return -1 if the cursor is empty
    +         if (firstPage >= 0) {
    +            nonEmptyCursorNum++;
    +            if (firstPage < minPage) {
    +               minPage = firstPage;
    +               slowSubscription = cursor.getQueue().getMessageCount() == 0 
? cursor : null;
    +            }
    +         }
    +      }
    +
    +      if (nonEmptyCursorNum > 1 && slowSubscription != null) {
    --- End diff --
    
    > this is saving a deliveryAsync call.. but I"m just wondering if it would 
be too costly to do the check on every queue?
    
    All PageSubcriptions use the same executor and it will do many jobs such as 
PageSubscriptionImpl::cleanupEntries, DepageRunner, DeliverRunner, 
ExpiryScanner, PageCursorProviderImpl::scheduleCleanup, 
PageCursorProviderImpl::cleanup, etc. We'd better prevent these  extra needless 
deliverAsync calls.


> Paging not stopped if there are no consumers on one subscription
> ----------------------------------------------------------------
>
>                 Key: ARTEMIS-2123
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-2123
>             Project: ActiveMQ Artemis
>          Issue Type: Bug
>          Components: Broker
>    Affects Versions: 2.6.3
>            Reporter: yangwei
>            Priority: Major
>
> Reproduction steps:
>  # create a topic t and two subscriptions ta, tb
>  # send messages to ta and tb
>  # create ta consumers and receive all messages from ta
>  # close consumers
>  # only send message to tb
>  # create tb consumers and receive all message from tb
>  # topic not stopped paging



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

Reply via email to