hangc0276 opened a new pull request #6862:
URL: https://github.com/apache/pulsar/pull/6862
Fix #6854
### Bug description
The consumer stuck due to `hasEnoughMessagesForBatchReceive` checking:
```
protected boolean hasEnoughMessagesForBatchReceive() {
if (batchReceivePolicy.getMaxNumMessages() <= 0 &&
batchReceivePolicy.getMaxNumBytes() <= 0) {
return false;
}
return (batchReceivePolicy.getMaxNumMessages() > 0 &&
incomingMessages.size() >= batchReceivePolicy.getMaxNumMessages())
|| (batchReceivePolicy.getMaxNumBytes() > 0 &&
INCOMING_MESSAGES_SIZE_UPDATER.get(this) >=
batchReceivePolicy.getMaxNumBytes());
}
```
### Changes
When batchReceivePolicy maxNumMessages > maxReceiverQueueSize, we force
batch receivePolicy maxNumMessages to maxReceiverQueueSize to avoid consumer
stuck when checking `hasEnoughMessagesForBatchReceive`
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]