jolshan commented on a change in pull request #10952:
URL: https://github.com/apache/kafka/pull/10952#discussion_r669065110



##########
File path: clients/src/main/java/org/apache/kafka/clients/Metadata.java
##########
@@ -377,6 +397,12 @@ else if (metadata.error() == 
Errors.TOPIC_AUTHORIZATION_FAILED)
                 log.debug("Updating last seen epoch for partition {} from {} 
to epoch {} from new metadata", tp, currentEpoch, newEpoch);
                 lastSeenLeaderEpochs.put(tp, newEpoch);
                 return Optional.of(partitionMetadata);
+            // If the topic ID changed, updated the metadata
+            } else if (changedTopicId) {
+                log.debug("Topic ID changed, so this topic must have been 
recreated. " +
+                        "Removing last seen epoch {} for the old partition {} 
and adding epoch {} from new metadata", currentEpoch, tp, newEpoch);
+                lastSeenLeaderEpochs.put(tp, newEpoch);
+                return Optional.of(partitionMetadata);

Review comment:
       I see. I think the main issue here was that we would ignore metadata 
updates when we were simply looking at the epoch. I believe that this PR solves 
the problem, but we can continue to improve beyond 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