cmccabe commented on code in PR #13407: URL: https://github.com/apache/kafka/pull/13407#discussion_r1163349040
########## metadata/src/main/java/org/apache/kafka/controller/QuorumController.java: ########## @@ -1142,9 +1190,20 @@ public ControllerResult<Void> generateRecordsAndResult() throws Exception { "at metadata.version {} from {}.", bootstrapMetadata.records().size(), bootstrapMetadata.metadataVersion(), bootstrapMetadata.source()); records.addAll(bootstrapMetadata.records()); - } else if (featureControl.metadataVersion().equals(MetadataVersion.MINIMUM_KRAFT_VERSION)) { - log.info("No metadata.version feature level record was found in the log. " + + + // Bootstrap the initial ZK Migration record + featureControl.generateZkMigrationRecord( + bootstrapMetadata.metadataVersion(), true, records::add); + } else { + // Logs have been replayed. We need to initialize some things here if upgrading from older KRaft versions + if (featureControl.metadataVersion().equals(MetadataVersion.MINIMUM_KRAFT_VERSION)) { + log.info("No metadata.version feature level record was found in the log. " + "Treating the log as version {}.", MetadataVersion.MINIMUM_KRAFT_VERSION); + } + + // Initialize the ZK migration state as NONE, or throw an error if we find an in-progress migration Review Comment: I don't think we need to do anything here. If the log isn't empty, we have whatever state we have... if we're migrating then we're migrating, otherwise not. We don't want to throw an exception if there is an in-progress migration since it's valid to have a controller failover while in MIGRATION state (or even just restart the cluster nodes in that state) -- 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