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


##########
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:
   The case where we don't call `renameDir` before `delete` is during 
`LogManager.loadLog`.
   ```java
   if (logDir.getName.endsWith(UnifiedLog.DeleteDirSuffix)) {
         addLogToBeDeleted(log)
       } 
   ```



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