prat0318 commented on a change in pull request #11552:
URL: https://github.com/apache/kafka/pull/11552#discussion_r759880730



##########
File path: clients/src/main/java/org/apache/kafka/clients/Metadata.java
##########
@@ -394,7 +394,8 @@ else if (metadata.error() == 
Errors.TOPIC_AUTHORIZATION_FAILED)
         if (hasReliableLeaderEpoch && 
partitionMetadata.leaderEpoch.isPresent()) {
             int newEpoch = partitionMetadata.leaderEpoch.get();
             Integer currentEpoch = lastSeenLeaderEpochs.get(tp);
-            if (topicId != null && oldTopicId != null && 
!topicId.equals(oldTopicId)) {
+            // oldTopicId can be null (when metadata is fetched during topic 
recreation), update the metadata in that case as well.

Review comment:
       Ack. Changed the comment as per the suggestion.
   
   > would it make sense to move this into the corresponding branch that it 
applies to?
   Sorry, couldn't get it. Can you elaborate on this please.

##########
File path: clients/src/main/java/org/apache/kafka/clients/Metadata.java
##########
@@ -394,7 +394,8 @@ else if (metadata.error() == 
Errors.TOPIC_AUTHORIZATION_FAILED)
         if (hasReliableLeaderEpoch && 
partitionMetadata.leaderEpoch.isPresent()) {
             int newEpoch = partitionMetadata.leaderEpoch.get();
             Integer currentEpoch = lastSeenLeaderEpochs.get(tp);
-            if (topicId != null && oldTopicId != null && 
!topicId.equals(oldTopicId)) {
+            // oldTopicId can be null (when metadata is fetched during topic 
recreation), update the metadata in that case as well.

Review comment:
       Ack. Changed the comment as per the suggestion.
   
   > would it make sense to move this into the corresponding branch that it 
applies to?
   
   Sorry, couldn't get it. Can you elaborate on this please.

##########
File path: clients/src/main/java/org/apache/kafka/clients/Metadata.java
##########
@@ -394,7 +394,8 @@ else if (metadata.error() == 
Errors.TOPIC_AUTHORIZATION_FAILED)
         if (hasReliableLeaderEpoch && 
partitionMetadata.leaderEpoch.isPresent()) {
             int newEpoch = partitionMetadata.leaderEpoch.get();
             Integer currentEpoch = lastSeenLeaderEpochs.get(tp);
-            if (topicId != null && oldTopicId != null && 
!topicId.equals(oldTopicId)) {
+            // oldTopicId can be null (when metadata is fetched during topic 
recreation), update the metadata in that case as well.
+            if (topicId != null && !topicId.equals(oldTopicId)) {
                 // If both topic IDs were valid and the topic ID changed, 
update the metadata

Review comment:
       updated.




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