You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2018/07/17 01:48:00 UTC

[jira] [Commented] (KAFKA-6784) FindCoordinatorResponse cannot be cast to FetchResponse

    [ https://issues.apache.org/jira/browse/KAFKA-6784?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16545934#comment-16545934 ] 

ASF GitHub Bot commented on KAFKA-6784:
---------------------------------------

koqizhao closed pull request #4865: KAFKA-6784: FindCoordinatorResponse cannot be cast to FetchResponse
URL: https://github.com/apache/kafka/pull/4865
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/clients/src/main/java/org/apache/kafka/clients/consumer/internals/Fetcher.java b/clients/src/main/java/org/apache/kafka/clients/consumer/internals/Fetcher.java
index 6d8fb6c2466..01e25196dfc 100644
--- a/clients/src/main/java/org/apache/kafka/clients/consumer/internals/Fetcher.java
+++ b/clients/src/main/java/org/apache/kafka/clients/consumer/internals/Fetcher.java
@@ -203,6 +203,10 @@ public int sendFetches() {
                     .addListener(new RequestFutureListener<ClientResponse>() {
                         @Override
                         public void onSuccess(ClientResponse resp) {
+                            sensors.fetchLatency.record(resp.requestLatencyMs());
+                            if (!(resp.responseBody() instanceof FetchResponse))
+                                return;
+
                             FetchResponse response = (FetchResponse) resp.responseBody();
                             FetchSessionHandler handler = sessionHandlers.get(fetchTarget.id());
                             if (handler == null) {
@@ -227,8 +231,6 @@ public void onSuccess(ClientResponse resp) {
                                 completedFetches.add(new CompletedFetch(partition, fetchOffset, fetchData, metricAggregator,
                                         resp.requestHeader().apiVersion()));
                             }
-
-                            sensors.fetchLatency.record(resp.requestLatencyMs());
                         }
 
                         @Override


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> FindCoordinatorResponse cannot be cast to FetchResponse
> -------------------------------------------------------
>
>                 Key: KAFKA-6784
>                 URL: https://issues.apache.org/jira/browse/KAFKA-6784
>             Project: Kafka
>          Issue Type: Bug
>          Components: clients
>    Affects Versions: 1.1.0
>            Reporter: Qiang Zhao
>            Priority: Major
>              Labels: patch
>             Fix For: 2.1.0
>
>   Original Estimate: 48h
>  Remaining Estimate: 48h
>
> org.apache.kafka.clients.consumer.internals.Fetcher
>  
> {code:java}
>             client.send(fetchTarget, request)
>                     .addListener(new RequestFutureListener<ClientResponse>() {
>                         @Override
>                         public void onSuccess(ClientResponse resp) {
>                             FetchResponse response = (FetchResponse) resp.responseBody();
>  
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)