yws created KAFKA-12846: --------------------------- Summary: 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 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)