artemlivshits commented on code in PR #12365: URL: https://github.com/apache/kafka/pull/12365#discussion_r924801253
########## clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java: ########## @@ -1465,13 +1465,21 @@ public boolean isDone() { private class AppendCallbacks<K, V> implements RecordAccumulator.AppendCallbacks { private final Callback userCallback; private final ProducerInterceptors<K, V> interceptors; - private final ProducerRecord<K, V> record; - protected int partition = RecordMetadata.UNKNOWN_PARTITION; + private final String topic; + private final Integer recordPartition; + private final String recordLogString; + private volatile int partition = RecordMetadata.UNKNOWN_PARTITION; + private volatile TopicPartition topicPartition; private AppendCallbacks(Callback userCallback, ProducerInterceptors<K, V> interceptors, ProducerRecord<K, V> record) { this.userCallback = userCallback; this.interceptors = interceptors; - this.record = record; + // Extract record info as we don't want to keep a reference to the record during + // whole lifetime of the batch. Review Comment: I think it applies to all 3 fields: topic, recordPartition and recordLogString - we extract all this info from the record, so the comment is before we do that (in the PR it's kind of hard to see because of the inline discussion). Let me know if you think otherwise. -- 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