junrao commented on code in PR #16443: URL: https://github.com/apache/kafka/pull/16443#discussion_r1777588167
########## 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: In 3.9, there is only one feature that one could set. So that behavior won't be changing even if we fail fast? -- 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