dajac commented on code in PR #13023:
URL: https://github.com/apache/kafka/pull/13023#discussion_r1054106713


##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/SubscriptionState.java:
##########
@@ -620,7 +620,12 @@ public synchronized Optional<Integer> 
preferredReadReplica(TopicPartition tp, lo
      * @return the removed preferred read replica if set, None otherwise.
      */
     public synchronized Optional<Integer> 
clearPreferredReadReplica(TopicPartition tp) {
-        return assignedState(tp).clearPreferredReadReplica();
+        final TopicPartitionState topicPartitionState = 
assignedStateOrNull(tp);
+        if (topicPartitionState == null) {
+            return Optional.empty();
+        } else {

Review Comment:
   Sorry. I did not see your comment before merging. I agree that we could 
remove it but it is also ok with it. Other methods in this class are structured 
like this.



-- 
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: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to