lollipopjin commented on code in PR #8593:
URL: https://github.com/apache/rocketmq/pull/8593#discussion_r1734687969


##########
broker/src/main/java/org/apache/rocketmq/broker/processor/PopMessageProcessor.java:
##########
@@ -551,18 +551,24 @@ private CompletableFuture<Long> popMsgFromQueue(String 
topic, String attemptId,
             future.whenComplete((result, throwable) -> 
queueLockManager.unLock(lockKey));
             offset = getPopOffset(topic, requestHeader.getConsumerGroup(), 
queueId, requestHeader.getInitMode(),
                 true, lockKey, true);
-            if (isOrder && 
brokerController.getConsumerOrderInfoManager().checkBlock(attemptId, topic,
-                requestHeader.getConsumerGroup(), queueId, 
requestHeader.getInvisibleTime())) {
-                
future.complete(this.brokerController.getMessageStore().getMaxOffsetInQueue(topic,
 queueId) - offset + restNum);
-                return future;
-            }
 
+            // Current requests would calculate the total number of messages
+            // waiting to be filtered for new message arrival notifications in
+            // the long-polling service, need disregarding the backlog in order
+            // consumption scenario. If rest message num including the blocked
+            // queue accumulation would lead to frequent unnecessary wake-ups
+            // of long-polling requests, resulting unnecessary CPU usage.
+            // When client ack message, long-polling request would be 
notifications
+            // by AckMessageProcessor.ackOrderly() and message will not be 
delayed.
             if (isOrder) {
+                if (brokerController.getConsumerOrderInfoManager().checkBlock(
+                    attemptId, topic, requestHeader.getConsumerGroup(), 
queueId, requestHeader.getInvisibleTime())) {
+                    // should not add accumulation(max offset - consumer 
offset) here

Review Comment:
   LGTM,Means return the original restNum if lock failed.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to