Parkerhiphop opened a new pull request, #24239:
URL: https://github.com/apache/kafka/pull/24239
`DefaultRecordBatch.iterator()` eagerly decodes compressed batches into an
intermediate list.
Replace its callers with `streamingIterator()` to avoid this allocation and
explicitly close iterators, including on early returns and exceptions.
- Remove `Iterable<Record>` from the internal `RecordBatch` interface and
migrate callers to explicitly close their streaming iterators.
- Preserve the `Records.records()` contract by collecting the records from
each compressed v2 batch and closing its decompression stream before exposing
those records through the `Iterable`.
- Return an empty iterator for empty batches and reject negative record
counts before opening a decompression stream.
### Verification
```bash
./gradlew :clients:test \
--tests '*.DefaultRecordBatchTest' \
--tests '*.AbstractLegacyRecordBatchTest' \
--tests '*.ProducerBatchTest' \
--tests '*.CompletedFetchTest'
./gradlew :core:test --tests '*.SharePartitionTest.testContainsAbortMarker'
./gradlew :server:test \
--tests '*.ShareGroupDLQRecordFetcherTest' \
--tests '*.ShareGroupDLQStateManagerTest'
./gradlew checkstyleMain checkstyleTest spotlessCheck
```
--
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]