Jason918 commented on a change in pull request #14494:
URL: https://github.com/apache/pulsar/pull/14494#discussion_r836004198



##########
File path: 
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java
##########
@@ -411,10 +411,28 @@ public UnAckedMessageTracker getUnAckedMessageTracker() {
         return unsubscribeFuture;
     }
 
+    @Override
+    public void initReceiverQueueSize() {
+        if (conf.isAutoScaledReceiverQueueSizeEnabled()) {
+            // turn on autoScaledReceiverQueueSize
+            int size = Math.min(INITIAL_RECEIVER_QUEUE_SIZE, 
maxReceiverQueueSize);
+            if (batchReceivePolicy.getMaxNumMessages() > 0) {
+                // consumerImpl may store (half-1) permits locally.
+                size = Math.max(size, 2 * 
batchReceivePolicy.getMaxNumMessages() - 2);

Review comment:
       > If `batchReceivePolicy.getMaxNumMessages()` is close or equal to 
`maxReceiverQueueSize`, will `size` exceed the limit of 
`ConsumerBuilderImpl.receiverQueueSize()`?
   
   @aloyszhang Yes, it should exceed the limit if we expect it to consume 
normally. And this should be a pre-existing issue that consumer would get stuck 
if `batchReceivePolicy.getMaxNumMessages()` is equal to `receiverQueueSize`
   




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to