ijuma commented on code in PR #18845: URL: https://github.com/apache/kafka/pull/18845#discussion_r1952871969
########## metadata/src/main/java/org/apache/kafka/image/FeaturesDelta.java: ########## @@ -58,7 +59,14 @@ public void finishSnapshot() { public void replay(FeatureLevelRecord record) { if (record.name().equals(MetadataVersion.FEATURE_NAME)) { - metadataVersionChange = MetadataVersion.fromFeatureLevel(record.featureLevel()); + // Support for the `metadata.version` feature flag was added in IBP_3_3_IV0, so it's possible (but unlikely) that we read + // records with a feature level that is no longer supported for clusters that used a pre-release version of 3.3.0. + // We automatically fallback to IBP_3_3_IV3 in that case. We use explicit versions instead of `MINIMUM_VERSION` because + // we want to force an explicit decision if we change `MetadataVersion.MINIMUM_VERSION` in the future. + if (record.featureLevel() >= MINIMUM_PERSISTED_FEATURE_LEVEL && record.featureLevel() <= MetadataVersion.IBP_3_3_IV3.featureLevel()) + metadataVersionChange = MetadataVersion.IBP_3_3_IV3; Review Comment: @junrao @cmccabe Thoughts on this fallback? It seems like quite a rare edge case (since it requires usage of a pre-release version and for the older metadata version not to be compacted away if I understand correctly), but it seems fair to never fail while reading the log and the fallback code is pretty simple. -- 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