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


##########
core/src/main/scala/kafka/server/KafkaApis.scala:
##########
@@ -3603,13 +3603,16 @@ class KafkaApis(val requestChannel: RequestChannel,
     def sendResponseCallback(errors: Either[ApiError, Map[String, ApiError]]): 
Unit = {
       def createResponse(throttleTimeMs: Int): UpdateFeaturesResponse = {
         errors match {
+          // Hard-code version to 1 since version 2 will not be implemented 
for 4.0

Review Comment:
   Hmm, not sure that I follow. This PR is for 4.0, right?



##########
metadata/src/main/java/org/apache/kafka/controller/QuorumController.java:
##########
@@ -2305,11 +2306,23 @@ public CompletableFuture<UpdateFeaturesResponseData> 
updateFeatures(
         }).thenApply(result -> {
             UpdateFeaturesResponseData responseData = new 
UpdateFeaturesResponseData();
             responseData.setResults(new 
UpdateFeaturesResponseData.UpdatableFeatureResultCollection(result.size()));
-            result.forEach((featureName, error) -> responseData.results().add(
-                new UpdateFeaturesResponseData.UpdatableFeatureResult()
-                    .setFeature(featureName)
-                    .setErrorCode(error.error().code())
-                    .setErrorMessage(error.message())));
+            List<String> featuresWithErrors = new ArrayList<>();
+            result.forEach((featureName, error) -> {
+                if (!error.error().equals(Errors.NONE))  {
+                    featuresWithErrors.add(featureName + ":" + 
error.error().exceptionName() + " (" + error.message() + ")");
+                }
+                responseData.results().add(
+                    new UpdateFeaturesResponseData.UpdatableFeatureResult()
+                        .setFeature(featureName)
+                        .setErrorCode(error.error().code())
+                        .setErrorMessage(error.message()));
+            });
+            // If the request is a newer version, indicate the update failed 
with a top level error if any update failed.
+            if (context.requestHeader().requestApiVersion() > 1 && 
featuresWithErrors.size() > 0) {

Review Comment:
   If there is a partial failure, it seems weird to return an error at the top 
level but with no error at some features. In that case, none of the updated 
features is persisted. For example, in produce response, we set the partition 
level error to be the same as the top level.



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