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


##########
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:
   Is it guaranteed that we won't have a record with the older metadata version 
in the log in that case?



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