public void close() {
        recordsBuilder.close();
        if (!recordsBuilder.isControlBatch()) {
            CompressionRatioEstimator.updateEstimation(topicPartition.topic(),
                                                       recordsBuilder.compression().type(),
                                                       (float) recordsBuilder.compressionRatio());
        }
        reopened = false;
    }
Release resources required for record appends (e.g. compression buffers). Once this method is called, it's only
possible to update the RecordBatch header.
clients/src/main/java/org/apache/kafka/clients/producer/internals/ProducerBatch.java