You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have analyzed the root cause of the issue and its solutions.
Root Cause of the Issue
The issue arises because the default value of pullBatchSize in the Go Pull Consumer is set to 0. In RocketMQ’s implementation, maxMsgNums (which corresponds to pullBatchSize) cannot be 0, as this prevents correct access to the logical queue.
Specifically:
1. In your code, you did not set consumer.WithPullBatchSize(), which caused the default value of 0 to be used.
2. When this value is sent to the server, stricter parameter checks in the RocksDB storage mode result in message pull failures.
3. In the default ConsumeQueue storage mode, this issue might not be apparent due to fault tolerance mechanisms, but in RocksDB mode, it directly fails.
Solutions
Short-term Solution:
Explicitly set pullBatchSize when creating the Pull Consumer:
pullConsumer, err = rocketmq.NewPullConsumer(
consumer.WithGroupName(consumerGroupName),
consumer.WithNameServer(nameSrv),
consumer.WithMaxReconsumeTimes(2),
consumer.WithPullBatchSize(32), // Add this line and set a reasonable value (1-1024)
)
Long-term Solutions:
1. Set a reasonable default value (e.g., 32) for pullBatchSize in the Go client.
2. Add parameter validation to ensure that pullBatchSize falls within a valid range (1-1024).
3. Improve the documentation to clearly explain the requirements and limitations of this parameter.
Before Creating the Bug Report
I found a bug, not just asking a question, which should be created in GitHub Discussions.
I have searched the GitHub Issues and GitHub Discussions of this repository and believe that this is not a duplicate.
I have confirmed that this bug belongs to the current repository, not other repositories of RocketMQ.
Runtime platform environment
ubuntu 24.04
RocketMQ version
5.3.1
JDK Version
1.8.0
Describe the Bug
go pull consumer consume fail when storeType=defaultRocksDB
Steps to Reproduce
1、set
storeType=defaultRocksDB
in broker.conf2、consume message with go pull consumer:
What Did You Expect to See?
expect consume success
What Did You See Instead?
consume fail with message:
consumer request topic: test-topic, offset: 0, minOffset: 0, maxOffset: 1, but access logic queue failed. Correct nextBeginOffset to 0
I found the maxMsgNums is 0 in pull request:
Additional Context
the default pullBatchSize of go pull consumer is 0, but works fine with default consume queue.
The text was updated successfully, but these errors were encountered: