ezhou413 commented on code in PR #23483:
URL: https://github.com/apache/kafka/pull/23483#discussion_r4085727929
##########
clients/src/main/java/org/apache/kafka/clients/producer/internals/ChunkedRecordAccumulator.java:
##########
@@ -365,6 +356,23 @@ protected ProducerBatch createProducerBatch(TopicPartition
tp, MemoryRecordsBuil
return new ChunkedProducerBatch(tp, recordsBuilder, nowMs);
}
+ /**
+ * Upper bound on the bytes the batch's first record will write, used both
to pre-size the batch's
+ * chunks and as its write-limit basis. Starts from the uncompressed
record-size upper bound
+ * ({@link AbstractRecords#estimateSizeInBytesUpperBound}, which ignores
compression), then for a
+ * compressed codec inflates by the same {@link
MemoryRecordsBuilder#COMPRESSION_RATE_ESTIMATION_FACTOR}
+ * that {@link MemoryRecordsBuilder#estimatedBytesWrittenAfter} applies.
Without the inflation that
+ * first-record check (in {@link ChunkedProducerBatch#tryAppend}) can
demand ~5% more than was
+ * reserved and throw for large compressed records.
+ */
+ private int initialChunkedBatchSize(byte[] key, byte[] value, Header[]
headers) {
Review Comment:
Reverted this change
--
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]