muralibasani commented on code in PR #21676:
URL: https://github.com/apache/kafka/pull/21676#discussion_r3564483508


##########
clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java:
##########
@@ -1135,18 +1135,25 @@ private Future<RecordMetadata> doSend(ProducerRecord<K, 
V> record, Callback call
             // take into account broker load, the amount of data produced to 
each partition, etc.).
             int partition = partition(record, serializedKey, serializedValue, 
cluster);
 
-            setReadOnly(record.headers());
-            Header[] headers = record.headers().toArray();
-
-            int serializedSize = 
AbstractRecords.estimateSizeInBytesUpperBound(RecordBatch.CURRENT_MAGIC_VALUE,
-                    compression.type(), serializedKey, serializedValue, 
headers);
-            ensureValidRecordSize(serializedSize);
             long timestamp = record.timestamp() == null ? nowMs : 
record.timestamp();
 
-            // Append the record to the accumulator.  Note, that the actual 
partition may be
-            // calculated there and can be accessed via 
appendCallbacks.topicPartition.
-            RecordAccumulator.RecordAppendResult result = 
accumulator.append(record.topic(), partition, timestamp, serializedKey,
-                    serializedValue, headers, appendCallbacks, 
remainingWaitMs, nowMs, cluster);
+            final RecordAccumulator.RecordAppendResult result;
+            byte[] rawHeaders = record.rawSerializedHeaders();

Review Comment:
   Correct, and this is fixed with the new approach also I see.



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