You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Chia-Ping Tsai (Jira)" <ji...@apache.org> on 2020/08/25 17:12:00 UTC

[jira] [Created] (KAFKA-10433) Reuse the ByteBuffer in validating compressed records

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)