Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-16548

Avoid decompressing/collecting all records when all we want to do is to find a single matched record from remote storage

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 3.8.0
    • None
    • None

    Description

      https://github.com/apache/kafka/blob/437ebb941e1485a6f1ad7afbba3814bfa310c9cf/core/src/main/java/kafka/log/remote/RemoteLogManager.java#L465

      `DefaultRecordBatch#iterator` will decompress all records to a new collection when those records are in compression. That is a extra and unnecessary cost when we do early return.

      In short, we should use `streamingIterator` rather than `iterator` in this case.

      Attachments

        Issue Links

          Activity

            People

              m1a2st 黃竣陽
              chia7712 Chia-Ping Tsai
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: