sijie commented on a change in pull request #6384: [Issue 4804][Schema] encode
null key/value in KeyValue
URL: https://github.com/apache/pulsar/pull/6384#discussion_r383483473
##########
File path:
pulsar-client-api/src/main/java/org/apache/pulsar/common/schema/KeyValue.java
##########
@@ -98,8 +106,23 @@ public String toString() {
V value, Schema<V> valueWriter) {
byte [] keyBytes = keyWriter.encode(key);
byte [] valueBytes = valueWriter.encode(value);
- ByteBuffer byteBuffer = ByteBuffer.allocate(4 + keyBytes.length + 4 +
valueBytes.length);
-
byteBuffer.putInt(keyBytes.length).put(keyBytes).putInt(valueBytes.length).put(valueBytes);
+
+ int keyEncodeLength = 1 + (null == keyBytes ? 0 : 4 + keyBytes.length);
Review comment:
It seems that it is breaking the backward compatibility. Because it
introduces a new format of how key/value is stored. Can we introduce versioning
to the format and use message properties to indicate which version of the
forrmat that is used for serializing key/value pairs?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services