gitlw commented on code in PR #12029: URL: https://github.com/apache/kafka/pull/12029#discussion_r850665758
########## core/src/main/scala/kafka/log/UnifiedLog.scala: ########## @@ -573,9 +576,14 @@ class UnifiedLog(@volatile var logStartOffset: Long, case None => if (keepPartitionMetadataFile) { _topicId = Some(topicId) - if (!partitionMetadataFile.exists()) { - partitionMetadataFile.record(topicId) - scheduler.schedule("flush-metadata-file", maybeFlushMetadataFile) + partitionMetadataFile match { + case Some(partitionMetadataFile) => + if (!partitionMetadataFile.exists()) { + partitionMetadataFile.record(topicId) + scheduler.schedule("flush-metadata-file", maybeFlushMetadataFile) + } + case _ => warn(s"The topic id $topicId will not be persisted to the partition metadata file " + + "since the field is not initialized") Review Comment: That looks good to me, I'll revise this log and update the PR after resolving the other comments. -- 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