artemlivshits commented on code in PR #12365:
URL: https://github.com/apache/kafka/pull/12365#discussion_r924136058


##########
clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java:
##########
@@ -1491,20 +1495,25 @@ public void setPartition(int partition) {
 
             if (log.isTraceEnabled()) {

Review Comment:
   Ok, so what's the suggestion in this change?  Should I leave the code as is 
or remove assert?  Creating a new utility seems to be out of scope for this 
change.  We could have an offline discussion about asserts, I would be happy to 
see them used more often in Kafka.



##########
clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java:
##########
@@ -1491,20 +1495,25 @@ public void setPartition(int partition) {
 
             if (log.isTraceEnabled()) {
                 // Log the message here, because we don't know the partition 
before that.
-                log.trace("Attempting to append record {} with callback {} to 
topic {} partition {}", record, userCallback, record.topic(), partition);
+                log.trace("Attempting to append record {} with callback {} to 
topic {} partition {}", record, userCallback, topic, partition);
             }
+
+            // Reset record to null here so that it doesn't have to be alive 
as long as the batch is.
+            record = null;

Review Comment:
   It's missing the partition info. Previously, partition was calculated before 
doing RecordAccumulator.append so we could do tracing in the doSend, but now 
the partition may be calculated at the beginning of RecordAccumulator.append, 
so tracing needs to happen after it's known, but before the actual append 
proceeds.



-- 
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]

Reply via email to