kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ij...@apache.org
Subject kafka git commit: MINOR: FetchRequest.Builder maxBytes for version <3
Date Thu, 30 Mar 2017 11:36:19 GMT
Repository: kafka
Updated Branches:
  refs/heads/trunk 84a14fec2 -> c808e8955


MINOR: FetchRequest.Builder maxBytes for version <3

The maxBytes field should be set to DEFAULT_RESPONSE_MAX_BYTES,
the same way as the constructor using the Struct does.

codeveloped with mimaison

Author: Edoardo Comar <ecomar@uk.ibm.com>

Reviewers: Ismael Juma <ismael@juma.me.uk>

Closes #2694 from edoardocomar/MINOR-FetchRequest


Project: http://git-wip-us.apache.org/repos/asf/kafka/repo
Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/c808e895
Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/c808e895
Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/c808e895

Branch: refs/heads/trunk
Commit: c808e8955f23c551c86ec0f51683c88486ad394e
Parents: 84a14fe
Author: Edoardo Comar <ecomar@uk.ibm.com>
Authored: Thu Mar 30 12:33:59 2017 +0100
Committer: Ismael Juma <ismael@juma.me.uk>
Committed: Thu Mar 30 12:33:59 2017 +0100

----------------------------------------------------------------------
 .../java/org/apache/kafka/common/requests/FetchRequest.java  | 2 +-
 .../apache/kafka/common/requests/RequestResponseTest.java    | 8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/c808e895/clients/src/main/java/org/apache/kafka/common/requests/FetchRequest.java
----------------------------------------------------------------------
diff --git a/clients/src/main/java/org/apache/kafka/common/requests/FetchRequest.java b/clients/src/main/java/org/apache/kafka/common/requests/FetchRequest.java
index b843c66..6549f50 100644
--- a/clients/src/main/java/org/apache/kafka/common/requests/FetchRequest.java
+++ b/clients/src/main/java/org/apache/kafka/common/requests/FetchRequest.java
@@ -137,7 +137,7 @@ public class FetchRequest extends AbstractRequest {
         @Override
         public FetchRequest build(short version) {
             if (version < 3) {
-                maxBytes = -1;
+                maxBytes = DEFAULT_RESPONSE_MAX_BYTES;
             }
 
             return new FetchRequest(version, replicaId, maxWait, minBytes, maxBytes, fetchData);

http://git-wip-us.apache.org/repos/asf/kafka/blob/c808e895/clients/src/test/java/org/apache/kafka/common/requests/RequestResponseTest.java
----------------------------------------------------------------------
diff --git a/clients/src/test/java/org/apache/kafka/common/requests/RequestResponseTest.java
b/clients/src/test/java/org/apache/kafka/common/requests/RequestResponseTest.java
index ad7260e..2024f90 100644
--- a/clients/src/test/java/org/apache/kafka/common/requests/RequestResponseTest.java
+++ b/clients/src/test/java/org/apache/kafka/common/requests/RequestResponseTest.java
@@ -440,6 +440,14 @@ public class RequestResponseTest {
         createCreateTopicRequest(0, true);
     }
 
+    @Test
+    public void testFetchRequestMaxBytesOldVersions() throws Exception {
+        final short version = 1;
+        FetchRequest fr = createFetchRequest(version);
+        FetchRequest fr2 = new FetchRequest(fr.toStruct(), version);
+        assertEquals(fr2.maxBytes(), fr.maxBytes());
+    }
+    
     private RequestHeader createRequestHeader() {
         return new RequestHeader((short) 10, (short) 1, "", 10);
     }


Mime
View raw message