kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cmcc...@apache.org
Subject [kafka] branch 2.4 updated: MINOR: fix compatibility-breaking bug in RequestHeader (#7479)
Date Thu, 10 Oct 2019 20:53:45 GMT
This is an automated email from the ASF dual-hosted git repository.

cmccabe pushed a commit to branch 2.4
in repository https://gitbox.apache.org/repos/asf/kafka.git


The following commit(s) were added to refs/heads/2.4 by this push:
     new ce4ecc2  MINOR: fix compatibility-breaking bug in RequestHeader (#7479)
ce4ecc2 is described below

commit ce4ecc296f0a70393ee3b2837de7f40fc40af32b
Author: Colin Patrick McCabe <cmccabe@apache.org>
AuthorDate: Thu Oct 10 13:52:07 2019 -0700

    MINOR: fix compatibility-breaking bug in RequestHeader (#7479)
    
    Reviewers: David Arthur <mumrah@gmail.com>, Jason Gustafson <jason@confluent.io>,
Ismael Juma <ismael@juma.me.uk>
    (cherry picked from commit 5c4bbf9344d82ebcb98ff1444a5a6e5d8ff05215)
---
 clients/src/main/resources/common/message/RequestHeader.json      | 8 +++++++-
 .../java/org/apache/kafka/common/requests/RequestHeaderTest.java  | 2 +-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/clients/src/main/resources/common/message/RequestHeader.json b/clients/src/main/resources/common/message/RequestHeader.json
index 560b019..fbf4e2c 100644
--- a/clients/src/main/resources/common/message/RequestHeader.json
+++ b/clients/src/main/resources/common/message/RequestHeader.json
@@ -30,7 +30,13 @@
       "about": "The API version of this request." },
     { "name": "CorrelationId", "type": "int32", "versions": "0+",
       "about": "The correlation ID of this request." },
+
+    // The ClientId string must be serialized with the old-style two-byte length prefix.
+    // The reason is that older brokers must be able to read the request header for any
+    // ApiVersionsRequest, even if it is from a newer version.
+    // Since the client is sending the ApiVersionsRequest in order to discover what
+    // versions are supported, the client does not know the best version to use.
     { "name": "ClientId", "type": "string", "versions": "1+", "nullableVersions": "1+", "ignorable":
true,
-      "about": "The client ID string." }
+      "flexibleVersions": "none", "about": "The client ID string." }
   ]
 }
diff --git a/clients/src/test/java/org/apache/kafka/common/requests/RequestHeaderTest.java
b/clients/src/test/java/org/apache/kafka/common/requests/RequestHeaderTest.java
index 1a76939..2842ae8 100644
--- a/clients/src/test/java/org/apache/kafka/common/requests/RequestHeaderTest.java
+++ b/clients/src/test/java/org/apache/kafka/common/requests/RequestHeaderTest.java
@@ -69,7 +69,7 @@ public class RequestHeaderTest {
         RequestHeader header = new RequestHeader(ApiKeys.CREATE_DELEGATION_TOKEN, (short)
2, "", 10);
         assertEquals(2, header.headerVersion());
         ByteBuffer buffer = toBuffer(header.toStruct());
-        assertEquals(10, buffer.remaining());
+        assertEquals(11, buffer.remaining());
         RequestHeader deserialized = RequestHeader.parse(buffer);
         assertEquals(header, deserialized);
     }


Mime
View raw message