flore77 opened a new pull request, #21656:
URL: https://github.com/apache/kafka/pull/21656

   This implements: 
https://cwiki.apache.org/confluence/display/KAFKA/KIP-646+Serializer+API+should+support+ByteBuffer
     
   ## Summary
   
     - Adds serializeToByteBuffer() default method to the Serializer interface, 
returning ByteBuffer instead of byte[]
     - Overrides in built-in serializers (ByteArray, ByteBuffer, Bytes, 
Integer, Long, Short, Float, Double, Boolean, Void) with optimized 
implementations that avoid unnecessary copies
     - Updates the producer pipeline (KafkaProducer → RecordAccumulator → 
ProducerBatch) to use ByteBuffer end-to-end, eliminating byte[] → ByteBuffer 
wrapping in MemoryRecordsBuilder
     - Adds ByteBuffer overload to Partitioner interface with zero-copy 
optimization for exact backing arrays
     - Extends Utils.murmur2() and BuiltInPartitioner.partitionForKey() to 
accept ByteBuffer natively, with byte[] versions delegating to them
   
     ## Test plan
   
     - SerializationTest — verifies serializeToByteBuffer() matches serialize() 
output for all built-in serializers, null handling, and ByteBuffer zero-copy
     - PartitionerTest — verifies default ByteBuffer partition method passes 
backing array directly (zero-copy) and copies when buffer is a slice
     - KafkaProducerTest — end-to-end producer pipeline with ByteBuffer path
     - RecordAccumulatorTest, ProducerBatchTest, SenderTest, MockProducerTest — 
existing tests pass via byte[] overloads that delegate to ByteBuffer


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