Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #11572
Brief Description
mqadmin consumeMessageused(int) (maxOffset - offset + 1)as thepull batch size. For a queue with more than
Integer.MAX_VALUEremaining messages, this wrapped to a non-positive
maxNums;DefaultMQPullConsumerImplrejectsmaxNums <= 0and the queue stops.This change pulls in bounded batches of 32, the same size used by
PrintMessageByQueueCommand/PrintMessageSubCommandand aligned withthe broker's in-memory/disk batch limits, while keeping the
-ctotalsemantics unchanged.
I deliberately did not claim a long overflow at
maxOffset = minOffset + countLeft - 1: that branch is guarded bycountLeft < maxOffset - minOffset, so it cannot overflow. The issue isonly the int cast at the pull call.
How Did You Test This Change?
mvn -pl tools -Dtest=ConsumeMessageCommandTest testmvn -pl tools testtestExecuteDefaultWithLargeQueueUsesBoundedPullBatch:maxOffset = 3_000_000_000,-c = 3000000000;-1294967295.