RaidenE1 commented on code in PR #20325:
URL: https://github.com/apache/kafka/pull/20325#discussion_r2270897569
##########
core/src/main/scala/kafka/server/AutoTopicCreationManager.scala:
##########
@@ -112,6 +128,45 @@ class DefaultAutoTopicCreationManager(
}
}
+ override def getTopicCreationErrors(
+ topicNames: Set[String]
+ ): Map[String, String] = {
+ val currentTime = System.currentTimeMillis()
+ val errors = mutable.Map.empty[String, String]
+ val expiredKeys = mutable.Set.empty[String]
+
+ // Check requested topics and collect expired keys
+ topicNames.foreach { topicName =>
+ Option(topicCreationErrorCache.get(topicName)) match {
+ case Some(cachedError) if (currentTime - cachedError.timestamp) <=
errorCacheTtlMs =>
Review Comment:
@mjsax This is functionally equivalent to a cleanup process!
The TTL serves two purposes:
1. Errors from too long ago become meaningless since topics can be
recreated/issues
resolved
2. Lazy cleanup during queries is simpler than maintaining a separate
background
cleanup thread
Both approaches achieve the same result - just trading off code complexity
vs cleanup
timing.
--
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]