[ https://issues.apache.org/jira/browse/KAFKA-2756?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Matthew Bruce updated KAFKA-2756: --------------------------------- Affects Version/s: 0.9.0.0 Status: Patch Available (was: Open) diff --git a/clients/src/main/java/org/apache/kafka/clients/NetworkClient.java b/clients/src/main/java/org/apache/kafka/clients/NetworkClient.java index 2c56751..a253e6d 100644 --- a/clients/src/main/java/org/apache/kafka/clients/NetworkClient.java +++ b/clients/src/main/java/org/apache/kafka/clients/NetworkClient.java @@ -459,7 +459,8 @@ public class NetworkClient implements KafkaClient { ClientRequest req = inFlightRequests.completeNext(source); ResponseHeader header = ResponseHeader.parse(receive.payload()); short apiKey = req.request().header().apiKey(); - Struct body = (Struct) ProtoUtils.currentResponseSchema(apiKey).read(receive.payload()); + short apiVer = req.request().header().apiVersion(); + Struct body = (Struct) ProtoUtils.responseSchema(apiKey,apiVer).read(receive.payload()); correlate(req.request().header(), header); if (!metadataUpdater.maybeHandleCompletedReceive(req, now, body)) responses.add(new ClientResponse(req, now, false, body)); > Replication Broken between Kafka 0.8.2.1 and 0.9 - NetworkClient.java uses > wrong protocol version > ------------------------------------------------------------------------------------------------- > > Key: KAFKA-2756 > URL: https://issues.apache.org/jira/browse/KAFKA-2756 > Project: Kafka > Issue Type: Bug > Affects Versions: 0.9.0.0 > Reporter: Matthew Bruce > Assignee: Guozhang Wang > Fix For: 0.9.0.0 > > > During a rolling upgrade from 0.8.2.1 to 0.9.0.0, replication between 0.9.0.0 > and 0.8.2.1 fails due to > org.apache.kafka.clients.networkClient:handleCompletedReceives always using > the latest version of the API Key available instead of the one specified by > inter.broker.protocol.version. > This line should not use ProtoUtils.currentResponseSchema and instead call > ProtoUtils.ResponseSchema and specify a version explicitly: > {code} > Struct body = (Struct) > ProtoUtils.currentResponseSchema(apiKey).read(receive.payload()); > {code} > This results in WARN messages like the following in the server.log file as > the responses are decoded with the wrong Schema: > {code} > [2015-11-05 19:13:10,309] WARN [ReplicaFetcherThread-0-182050600], Error in > fetch kafka.server.ReplicaFetcherThread$FetchRequest@6cc18858. Possible > cause: org.apache.kafka.common.protocol.types.SchemaException: Error reading > field 'responses': Error reading field 'topic': > java.nio.BufferUnderflowException (kafka.server.ReplicaFetcherThread) > {code} > {code} > [2015-11-03 16:55:15,178] WARN [ReplicaFetcherThread-1-182050600], Error in > fetch kafka.server.ReplicaFetcherThread$FetchRequest@224388b2. Possible > cause: org.apache.kafka.common.protocol.types.SchemaException: Error reading > field 'responses': Error reading field 'partition_responses': Error reading > field 'record_set': java.lang.IllegalArgumentException > (kafka.server.ReplicaFetcherThread) > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)