chirag-wadhwa5 commented on code in PR #20280:
URL: https://github.com/apache/kafka/pull/20280#discussion_r2262877509


##########
core/src/main/java/kafka/server/share/DelayedShareFetch.java:
##########
@@ -765,7 +774,10 @@ private boolean maybeCompletePendingRemoteFetch() {
 
         for (TopicIdPartition topicIdPartition : 
pendingRemoteFetchesOpt.get().fetchOffsetMetadataMap().keySet()) {
             try {
-                
replicaManager.getPartitionOrException(topicIdPartition.topicPartition());
+                Partition partition = 
replicaManager.getPartitionOrException(topicIdPartition.topicPartition());
+                if (!partition.isLeader()) {
+                    throw new NotLeaderException("Broker is no longer the 
leader of topicPartition: " + topicIdPartition);

Review Comment:
   Thanks for the review. Yep, I have added another catch block here for the 
new NotLeaderException thrown.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to