mimaison commented on code in PR #19762: URL: https://github.com/apache/kafka/pull/19762#discussion_r2297657107
########## storage/src/main/java/org/apache/kafka/storage/internals/log/LogManager.java: ########## @@ -58,39 +54,25 @@ public static boolean waitForAllToComplete(List<Future<?>> jobs, Consumer<Throwa } /** - * Returns true if the given log should not be on the current broker - * according to the metadata image. + * Returns true if the given log should not be on the current broker according to the metadata. * + * @param replicas The replicas hosting the partition * @param brokerId The ID of the current broker. - * @param newTopicsImage The new topics image after broker has been reloaded + * @param topicId The ID of the topic * @param log The log object to check * @return true if the log should not exist on the broker, false otherwise. */ - public static boolean isStrayKraftReplica(int brokerId, TopicsImage newTopicsImage, UnifiedLog log) { - if (log.topicId().isEmpty()) { - // Missing topic ID could result from storage failure or unclean shutdown after topic creation but before flushing - // data to the `partition.metadata` file. And before appending data to the log, the `partition.metadata` is always - // flushed to disk. So if the topic ID is missing, it mostly means no data was appended, and we can treat this as - // a stray log. - LOG.info("The topicId does not exist in {}, treat it as a stray log.", log); + public static boolean isStrayReplica(List<Integer> replicas, int brokerId, Uuid topicId, UnifiedLog log) { Review Comment: Good call. Fixed -- 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