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


##########
clients/src/main/resources/common/message/UpdateFeaturesResponse.json:
##########
@@ -17,7 +17,7 @@
   "apiKey": 57,
   "type": "response",
   "name": "UpdateFeaturesResponse",
-  "validVersions": "0-1",
+  "validVersions": "0-2",

Review Comment:
   Should we remove the `Results` field in V2?



##########
metadata/src/main/java/org/apache/kafka/controller/FeatureControlManager.java:
##########
@@ -172,14 +173,25 @@ private FeatureControlManager(
     ControllerResult<Map<String, ApiError>> updateFeatures(
         Map<String, Short> updates,
         Map<String, FeatureUpdate.UpgradeType> upgradeTypes,
-        boolean validateOnly
+        boolean validateOnly,
+        short requestVersion
     ) {
         TreeMap<String, ApiError> results = new TreeMap<>();
         List<ApiMessageAndVersion> records =
                 BoundedList.newArrayBacked(MAX_RECORDS_PER_USER_OP);
+
+        Map<String, Short> proposedUpdatedVersions = new HashMap<>();
+        finalizedVersions.forEach(proposedUpdatedVersions::put);
+        proposedUpdatedVersions.put(MetadataVersion.FEATURE_NAME, 
metadataVersion.get().featureLevel());
+        updates.forEach(proposedUpdatedVersions::put);
+
         for (Entry<String, Short> entry : updates.entrySet()) {
-            results.put(entry.getKey(), updateFeature(entry.getKey(), 
entry.getValue(),
-                upgradeTypes.getOrDefault(entry.getKey(), 
FeatureUpdate.UpgradeType.UPGRADE), records));
+            ApiError error = updateFeature(entry.getKey(), entry.getValue(),
+                upgradeTypes.getOrDefault(entry.getKey(), 
FeatureUpdate.UpgradeType.UPGRADE), records, proposedUpdatedVersions);
+            if (requestVersion > 1 && !error.error().equals(Errors.NONE)) {

Review Comment:
   Thinking about a bit more. Even for V0/V1 request, it's probably better to 
enforce the dependency check since it's more correct. Perhaps it's better to 
just fail fast for all versions?



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