jolshan commented on code in PR #16443:
URL: https://github.com/apache/kafka/pull/16443#discussion_r1775712634
##########
metadata/src/main/java/org/apache/kafka/controller/FeatureControlManager.java:
##########
@@ -174,15 +175,27 @@ ControllerResult<Map<String, ApiError>> updateFeatures(
Map<String, FeatureUpdate.UpgradeType> upgradeTypes,
boolean validateOnly
) {
+ boolean updateFailed = false;
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);
+ results.put(entry.getKey(), error);
+ if (!error.error().equals(Errors.NONE)) {
+ updateFailed = true;
+ break;
+ }
}
- if (validateOnly) {
+ if (validateOnly || updateFailed) {
Review Comment:
Taking a closer look at this -- are you suggesting to return a different
type of controller response here? There are a few options. One is to simply
return the feature and error that caused the failure above (in the if block).
Another is to modify the type to account for top level errors.
--
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]