Chia-Ping Tsai created KAFKA-10433:
--------------------------------------

             Summary: Reuse the ByteBuffer in validating compressed records 
                 Key: KAFKA-10433
                 URL: https://issues.apache.org/jira/browse/KAFKA-10433
             Project: Kafka
          Issue Type: Improvement
            Reporter: Chia-Ping Tsai
            Assignee: Chia-Ping Tsai


{code:java}
for (batch <- batches) {
  validateBatch(topicPartition, firstBatch, batch, origin, toMagic, 
brokerTopicStats)
  uncompressedSizeInBytes += 
AbstractRecords.recordBatchHeaderSizeInBytes(toMagic, batch.compressionType())

  val recordsIterator = if (inPlaceAssignment && firstBatch.magic >= 
RecordBatch.MAGIC_VALUE_V2)
    batch.skipKeyValueIterator(BufferSupplier.NO_CACHING)
  else
    batch.streamingIterator(BufferSupplier.NO_CACHING)
{code}

It is hot method so reusing the ByteBuffer can reduce a bunch of memory usage 
if the compression type supports BufferSupplier.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to