jsancio commented on code in PR #19416:
URL: https://github.com/apache/kafka/pull/19416#discussion_r2051809216


##########
metadata/src/main/java/org/apache/kafka/controller/FeatureControlManager.java:
##########
@@ -225,6 +272,32 @@ private ApiError updateFeature(
         if (featureName.equals(MetadataVersion.FEATURE_NAME)) {
             // Perform additional checks if we're updating metadata.version
             return updateMetadataVersion(newVersion, 
upgradeType.equals(FeatureUpdate.UpgradeType.UNSAFE_DOWNGRADE), records::add);
+        } else if (featureName.equals(KRaftVersion.FEATURE_NAME)) {
+            if (upgradeType.equals(FeatureUpdate.UpgradeType.UPGRADE)) {
+                try {
+                    kraftVersionAccessor.upgradeKRaftVersion(
+                        currentClaimedEpoch,
+                        KRaftVersion.fromFeatureLevel(newVersion),
+                        validateOnly
+                    );
+                    /* Add the noop record so that there is at least one 
offset to wait on to
+                     * complete the upgrade RPC
+                     */
+                    records.add(new ApiMessageAndVersion(new NoOpRecord(), 
(short) 0));

Review Comment:
   We could. I was trying to make it consistent with the rest of the code in 
this method. For other features, this code always adds an ApiMessageAndVersion 
to the records list. It is the caller of this method, `updateFeatures`, that 
returns an empty list if the RPC is meant to only validate.



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

Reply via email to