jolshan commented on code in PR #14885: URL: https://github.com/apache/kafka/pull/14885#discussion_r1414508061
########## core/src/main/scala/kafka/coordinator/group/CoordinatorPartitionWriter.scala: ########## @@ -126,57 +129,63 @@ class CoordinatorPartitionWriter[T]( val magic = logConfig.recordVersion.value val maxBatchSize = logConfig.maxMessageSize val currentTimeMs = time.milliseconds() - - val recordsBuilder = MemoryRecords.builder( - ByteBuffer.allocate(math.min(16384, maxBatchSize)), - magic, - compressionType, - TimestampType.CREATE_TIME, - 0L, - time.milliseconds(), - producerId, - producerEpoch, - 0, - producerId != RecordBatch.NO_PRODUCER_ID, - RecordBatch.NO_PARTITION_LEADER_EPOCH - ) - - records.forEach { record => - val keyBytes = serializer.serializeKey(record) - val valueBytes = serializer.serializeValue(record) - - if (recordsBuilder.hasRoomFor(currentTimeMs, keyBytes, valueBytes, EMPTY_HEADERS)) recordsBuilder.append( - currentTimeMs, - keyBytes, - valueBytes, - EMPTY_HEADERS - ) else throw new RecordTooLargeException(s"Message batch size is ${recordsBuilder.estimatedSizeInBytes()} bytes " + - s"in append to partition $tp which exceeds the maximum configured size of $maxBatchSize.") + val bufferSupplier = threadLocalBufferSupplier.get() + val buffer = bufferSupplier.get(math.min(16384, maxBatchSize)) Review Comment: Is this 16384 just the default batch size? -- 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: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org