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



##########
File path: clients/src/main/java/org/apache/kafka/clients/Metadata.java
##########
@@ -394,8 +394,12 @@ 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)) {
-                // If both topic IDs were valid and the topic ID changed, 
update the metadata
+            // Between the time that a topic is deleted and re-created, the 
client may lose
+            // track of the corresponding topicId (i.e. `oldTopicId` will be 
null). In this case,
+            // when we discover the new topicId, we allow the corresponding 
leader epoch
+            // to override the last seen value.

Review comment:
       moved as per the suggestion.




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