chia7712 commented on code in PR #17099:
URL: https://github.com/apache/kafka/pull/17099#discussion_r1830330819


##########
clients/src/main/java/org/apache/kafka/clients/producer/internals/ProducerInterceptors.java:
##########
@@ -107,14 +110,21 @@ public void onAcknowledgement(RecordMetadata metadata, 
Exception exception) {
     public void onSendError(ProducerRecord<K, V> record, TopicPartition 
interceptTopicPartition, Exception exception) {
         for (ProducerInterceptor<K, V> interceptor : this.interceptors) {
             try {
+                Headers headers = record != null ? record.headers() : null;
+                if (headers instanceof RecordHeaders && !((RecordHeaders) 
headers).isReadOnly()) {
+                    // make a copy of the headers to make sure it is read-only

Review Comment:
   The copy is required because we don't want to change the state of origin 
record's headers, right? If so, could you please enhance the comment?



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