You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "zjncs (via GitHub)" <gi...@apache.org> on 2026/09/08 04:08:06 UTC

[PR] fix(client): return the configured total batch max bytes from ProduceAccumulator [rocketmq]

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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(client): return the configured total batch max bytes from ProduceAccumulator [rocketmq]

Posted by "zjncs (via GitHub) via commits" <co...@rocketmq.apache.org>.
zjncs closed pull request #11061: fix(client): return the configured total batch max bytes from ProduceAccumulator
URL: https://github.com/apache/rocketmq/pull/11061


-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org