xelathan commented on code in PR #18919: URL: https://github.com/apache/kafka/pull/18919#discussion_r1957411153
########## clients/src/main/java/org/apache/kafka/common/record/RecordsUtil.java: ########## @@ -89,10 +89,11 @@ protected static ConvertedRecords<MemoryRecords> downConvert(Iterable<? extends buffer = Utils.ensureCapacity(buffer, buffer.position() + recordBatchAndRecords.batch.sizeInBytes()); recordBatchAndRecords.batch.writeTo(buffer); } else { - MemoryRecordsBuilder builder = convertRecordBatch(toMagic, buffer, recordBatchAndRecords); - buffer = builder.buffer(); - temporaryMemoryBytes += builder.uncompressedBytesWritten(); - numRecordsConverted += builder.numRecords(); + try (MemoryRecordsBuilder builder = convertRecordBatch(toMagic, buffer, recordBatchAndRecords)) { Review Comment: If `Records#downConvert` is being removed by [#18897](https://github.com/apache/kafka/pull/18897) then closing wouldn't really be necessary. I'll go ahead and close the PR. -- 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