zjncs opened a new pull request, #11061:
URL: https://github.com/apache/rocketmq/pull/11061
### Motivation
`ProduceAccumulator.getTotalBatchMaxBytes()` returns `holdSize` (the
per-batch cap, default 32KB) instead of `totalHoldSize` (the accumulator-wide
cap, default 32MB):
```java
long getBatchMaxBytes() {
return holdSize; // correct: per-batch cap
}
long getTotalBatchMaxBytes() {
return holdSize; // wrong: returns the per-batch field
}
```
`DefaultMQProducer.getTotalBatchMaxBytes()` delegates here, while
`DefaultMQProducer.totalBatchMaxBytes(long)` (also applied in
`initProduceAccumulator`) writes `totalHoldSize`. So with untouched defaults
the getter reports 32KB while `tryAddMessage` actually enforces 32MB, and after
`producer.setTotalBatchMaxBytes(64MB)` the getter still returns 32KB.
### Modifications
Return `totalHoldSize` from `getTotalBatchMaxBytes()`.
### Verification
Fail-before (new test `testGetTotalBatchMaxBytes`, run against the unpatched
code):
```
Tests run: 4, Failures: 1, Errors: 0 -- ProduceAccumulatorTest
expecting actual 32768L to be equal to 33554432L
```
Pass-after:
```
Tests run: 4, Failures: 0, Errors: 0, Skipped: 0 -- ProduceAccumulatorTest
```
--
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]