mumrah commented on a change in pull request #8841: URL: https://github.com/apache/kafka/pull/8841#discussion_r438379247
########## File path: clients/src/main/java/org/apache/kafka/clients/consumer/internals/Fetcher.java ########## @@ -675,36 +676,41 @@ private ListOffsetResult fetchOffsetsByTimes(Map<TopicPartition, Long> timestamp completedFetch.partition); } else { FetchPosition position = subscriptions.position(completedFetch.partition); - if (completedFetch.nextFetchOffset == position.offset) { - List<ConsumerRecord<K, V>> partRecords = completedFetch.fetchRecords(maxRecords); - - log.trace("Returning {} fetched records at offset {} for assigned partition {}", - partRecords.size(), position, completedFetch.partition); - - if (completedFetch.nextFetchOffset > position.offset) { - FetchPosition nextPosition = new FetchPosition( - completedFetch.nextFetchOffset, - completedFetch.lastEpoch, - position.currentLeader); - log.trace("Update fetching position to {} for partition {}", nextPosition, completedFetch.partition); - subscriptions.position(completedFetch.partition, nextPosition); - } + if (position != null) { Review comment: Yea, I see what you mean. It's probably a good idea to add a check here. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org