diff --git a/clients/src/main/java/org/apache/kafka/common/serialization/Deserializer.java b/clients/src/main/java/org/apache/kafka/common/serialization/Deserializer.java index 9fd8d50be74..ad8d2bfe4d4 100644 --- a/clients/src/main/java/org/apache/kafka/common/serialization/Deserializer.java +++ b/clients/src/main/java/org/apache/kafka/common/serialization/Deserializer.java @@ -63,7 +63,15 @@ public interface Deserializer extends Closeable { } /** - * Deserialize a record value from a ByteBuffer into a value or object. + * Deserialize a record value from a {@link ByteBuffer} into a value or object. + * + *

If {@code ByteBufferDeserializer} is used by an application, the application code cannot make any assumptions + * about the returned {@link ByteBuffer} like the position, limit, capacity, etc., or if it is backed by + * {@link ByteBuffer#hasArray() an array or not}. + * + *

Similarly, if this method is overridden, the implementation cannot make any assumptions about the + * passed in {@link ByteBuffer} either. + * * @param topic topic associated with the data * @param headers headers associated with the record; may be empty. * @param data serialized ByteBuffer; may be null; implementations are recommended to handle null by returning a value or null rather than throwing an exception. diff --git a/docs/upgrade.html b/docs/upgrade.html index 460628864c0..bb1f4ae9287 100644 --- a/docs/upgrade.html +++ b/docs/upgrade.html @@ -90,9 +90,9 @@

  • The Apache Zookeeper dependency has been upgraded to 3.8.1 due to 3.6 reaching end-of-life. To bring both your Kafka and Zookeeper clusters to the latest versions: @@ -122,6 +122,10 @@ The configuration can also be updated dynamically and is applied to the broker. Workloads running on version 3.6.0 with compression can experience InvalidRecordExceptions and UnknownServerExceptions. Upgrading to 3.6.1 or newer or disabling the feature fixes the issue.
  • +
  • The ByteBufferDeserializer (KIP-863) + was changed to avoid unnecessary deep-copies of data. This changes the behavior of the deserializer as user code cannot make any assumptions + about buffer position, limit, capacity any longer. +
  • Upgrading to 3.5.2 from any version 0.8.x through 3.4.x