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

Luke Chen commented on KAFKA-12846:
-----------------------------------

[~ws], I believe the comments in else block answers your question. I'm not sure 
what your expected result is. Are you trying to get rid of the else block? If 
so, maybe you have to prove the comment is wrong, so that we can get rid of it. 
What do you think?

> why need this logic in Consumer‘s Fetch logic   it should remove?
> -----------------------------------------------------------------
>
>                 Key: KAFKA-12846
>                 URL: https://issues.apache.org/jira/browse/KAFKA-12846
>             Project: Kafka
>          Issue Type: Wish
>            Reporter: yws
>            Priority: Trivial
>             Fix For: 2.3.0
>
>
> package: org.apache.kafka.clients.consumer.internals
> class: Fetcher
> else {
>                             // this case shouldn't usually happen because we 
> only send one fetch at a time per partition,
>                             // but it might conceivably happen in some rare 
> cases (such as partition leader changes).
>                             // we have to copy to a new list because the old 
> one may be immutable
>                             List<ConsumerRecord<K, V>> newRecords = new 
> ArrayList<>(records.size() + currentRecords.size());
>                             newRecords.addAll(currentRecords);
>                             newRecords.addAll(records);
>                             fetched.put(partition, newRecords);
>                         }
>                         recordsRemaining -= records.size();
>                     }
> I just cannot think of the case that it will goes to the else logic,  who can 
> illustrate it? it's useless logic in my opinion, looking forward to reply!



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to