Caideyipi opened a new pull request, #18560:
URL: https://github.com/apache/iotdb/pull/18560

   ## Description
   
   ### Problem
   
   #18522 changed IoTConsensus batch accumulation from a fixed sleep to an 
interruptible queue poll, but it considered a batch full only when the 
entry-count limit was reached. The actual batch builder also applies 
`maxSizePerBatch`, including the receiver-memory multiplier.
   
   For large Tablet writes, the byte limit is reached well before the default 
1024-entry limit. The dispatcher therefore continued waiting for the rest of 
the accumulation interval (500 ms by default) even though the next batch was 
already full, causing the 3C5D throughput regression.
   
   ### Changes
   
   - Reuse the same entry-count and effective-byte-size predicate for waiting 
and batch construction.
   - Track the memory size of requests moved into `bufferedEntries` and stop 
waiting as soon as either batch limit is reached.
   - Add a focused unit test with a deliberately long accumulation interval to 
verify that reaching the byte limit sends immediately.
   
   ### Tests
   
   - `mvn spotless:apply -pl iotdb-core/consensus`
   - `mvn -pl iotdb-core/consensus '-Dtest=LogDispatcherTest' test` (4 tests)
   - `mvn -pl iotdb-core/consensus test`
   
   <hr>
   
   This PR has:
   - [x] been self-reviewed.
   - [x] concurrent write
   - [x] added comments explaining the why and intent where it is not obvious.
   - [x] added a unit test covering the byte-limit path.
   
   <hr>
   
   ##### Key changed/added classes (or packages if there are too many classes) 
in this PR
   
   - `Batch`
   - `LogDispatcher`
   - `LogDispatcherTest`


-- 
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]

Reply via email to