chia7712 commented on code in PR #15516:
URL: https://github.com/apache/kafka/pull/15516#discussion_r2655222766


##########
clients/src/main/java/org/apache/kafka/common/record/MemoryRecords.java:
##########
@@ -293,14 +294,15 @@ private static MemoryRecordsBuilder 
buildRetainedRecordsInto(RecordBatch origina
                                                                  
ByteBufferOutputStream bufferOutputStream,
                                                                  final long 
deleteHorizonMs) {
         byte magic = originalBatch.magic();
+        Compression compression = 
Compression.of(originalBatch.compressionType()).build();

Review Comment:
   Theoretically, having the cleaner produce multiple segments is the superior 
design. However, the current implementation strictly pre-groups the segments. 
Simply splitting an overflowing group would result in fragmented, undersized 
segments. To handle this gracefully would require major architectural surgery 
on the grouping logic. 
   
   Given that this overflow is a rare edge case, requiring a specific 
combination of large segments, significant compression drop, and low deletion 
rates, the adaptive safety margin is a much more pragmatic win.
   
   @junrao wdyt ?



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