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


##########
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:
   There is no guarantee, but the expected MV is IBP_3_3_IV3 and above. If this 
is not the case, it seems easier to just fail instead of changing it silently.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to