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


##########
core/src/main/scala/kafka/log/UnifiedLog.scala:
##########
@@ -509,8 +509,8 @@ class UnifiedLog(@volatile var logStartOffset: Long,
   }
 
   private def initializeLeaderEpochCache(): Unit = lock synchronized {
-    leaderEpochCache = UnifiedLog.maybeCreateLeaderEpochCache(
-      dir, topicPartition, logDirFailureChannel, logIdent, leaderEpochCache, 
scheduler)
+    leaderEpochCache = Some(UnifiedLog.createLeaderEpochCache(

Review Comment:
   I had done that at first, but then I noticed that the following code was 
setting this to `None`. What would be the appropriate behavior if we remove the 
`Option`? Would we set it to `null`? Happy to give that a try if that makes 
sense to you.
   
   ```java
   def renameDir(name: String, shouldReinitialize: Boolean): Unit = {
       lock synchronized {
         maybeHandleIOException(s"Error while renaming dir for $topicPartition 
in log dir ${dir.getParent}") {
           // Flush partitionMetadata file before initializing again
           maybeFlushMetadataFile()
           if (localLog.renameDir(name)) {
             producerStateManager.updateParentDir(dir)
             if (shouldReinitialize) {
               // re-initialize leader epoch cache so that 
LeaderEpochCheckpointFile.checkpoint can correctly reference
               // the checkpoint file in renamed log directory
               initializeLeaderEpochCache()
               initializePartitionMetadata()
             } else {
               leaderEpochCache = None
               partitionMetadataFile = None
             }
           }
         }
       }
     }
   ```



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