[ 
https://issues.apache.org/jira/browse/ARTEMIS-3850?focusedWorklogId=780842&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-780842
 ]

ASF GitHub Bot logged work on ARTEMIS-3850:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 13/Jun/22 14:22
            Start Date: 13/Jun/22 14:22
    Worklog Time Spent: 10m 
      Work Description: clebertsuconic commented on code in PR #4101:
URL: https://github.com/apache/activemq-artemis/pull/4101#discussion_r895783725


##########
artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java:
##########
@@ -3101,29 +3108,21 @@ protected void removeMessageReference(ConsumerHolder<? 
extends Consumer> holder,
       refRemoved(ref);
    }
 
-   private void checkDepage(boolean noWait) {
-      if (pageIterator != null && pageSubscription.isPaging() && 
!depagePending && needsDepage() && (noWait ? pageIterator.tryNext() > 0 : 
pageIterator.hasNext())) {
+   private void checkDepage() {
+      if (pageIterator != null && pageSubscription.isPaging() && 
!depagePending && needsDepage() && pageIterator.tryNext() != 
PageIterator.NextResult.noElements) {
          scheduleDepage(false);
       }
    }
 
    /**
-    * This is a common check we do before scheduling depaging.. or while 
depaging.
-    * Before scheduling a depage runnable we verify if it fits / needs 
depaging.
-    * We also check for while needsDepage While depaging.
-    * This is just to avoid a copy & paste dependency
+    *
+    * This is a check on page sizing.
     *
     * @return
     */
    private boolean needsDepage() {
-      return queueMemorySize.get() < 
pageSubscription.getPagingStore().getMaxSize() &&
-         /**
-          * In most cases, one depage round following by at most 
MAX_SCHEDULED_RUNNERS deliver round,
-          * thus we just need to read MAX_DELIVERIES_IN_LOOP * 
MAX_SCHEDULED_RUNNERS messages. If we read too much, the message reference
-          * maybe discarded by gc collector in response to memory demand and 
we need to read it again at
-          * a great cost when delivering.
-          */
-         intermediateMessageReferences.size() + messageReferences.size() < 
MAX_DEPAGE_NUM;
+      return queueMemorySize.getSize() < 
pageSubscription.getPagingStore().getMaxPageReadBytes() &&
+             queueMemorySize.getElements() < 
pageSubscription.getPagingStore().getMaxPageReadMessages();

Review Comment:
   we should not add more data on the Queue if it already has the maxRead.. 
this is correct





Issue Time Tracking
-------------------

    Worklog Id:     (was: 780842)
    Time Spent: 5.5h  (was: 5h 20m)

> Add Option to read messages into paging based on sizing and eliminate caching
> -----------------------------------------------------------------------------
>
>                 Key: ARTEMIS-3850
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-3850
>             Project: ActiveMQ Artemis
>          Issue Type: New Feature
>    Affects Versions: 2.22.0
>            Reporter: Clebert Suconic
>            Assignee: Clebert Suconic
>            Priority: Major
>             Fix For: 2.24.0
>
>          Time Spent: 5.5h
>  Remaining Estimate: 0h
>




--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to