ijuma commented on code in PR #18321:
URL: https://github.com/apache/kafka/pull/18321#discussion_r1907342970


##########
core/src/main/scala/kafka/log/UnifiedLog.scala:
##########
@@ -1768,7 +1759,9 @@ class UnifiedLog(@volatile var logStartOffset: Long,
       lock synchronized {
         localLog.checkIfMemoryMappedBufferClosed()
         producerExpireCheck.cancel(true)
-        leaderEpochCache.foreach(_.clear())
+        // `renameDir` with `shouldReinitialize=false` sets this to `null` and 
it's usually (but not always) called before this method
+        if (leaderEpochCache != null)
+          leaderEpochCache.clear()

Review Comment:
   @junrao This is interesting - do you think we should be setting the cache to 
`null` here too versus calling `clear` on it? It's a bit odd that we take 
different actions to achieve a similar outcome (clearing the in-memory state) 
in two different (but related) methods.



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