chia7712 commented on code in PR #17128:
URL: https://github.com/apache/kafka/pull/17128#discussion_r1750771062


##########
clients/src/main/java/org/apache/kafka/common/requests/BrokerRegistrationRequest.java:
##########
@@ -47,14 +47,14 @@ public short oldestAllowedVersion() {
         @Override
         public BrokerRegistrationRequest build(short version) {
             if (version < 4) {
-                // Workaround for KAFKA-17011: for BrokerRegistrationRequest 
versions older than 4,
-                // translate minSupportedVersion = 0 to minSupportedVersion = 
1.
+                // Workaround for KAFKA-17492: for BrokerRegistrationRequest 
versions older than 4,
+                // remove features with minSupportedVersion = 0.
                 BrokerRegistrationRequestData newData = data.duplicate();
                 for (Iterator<BrokerRegistrationRequestData.Feature> iter = 
newData.features().iterator();
                      iter.hasNext(); ) {
                     BrokerRegistrationRequestData.Feature feature = 
iter.next();
                     if (feature.minSupportedVersion() == 0) {
-                        feature.setMinSupportedVersion((short) 1);
+                        iter.remove();

Review Comment:
   How about using `removeIf`? 
   ```java
   newData.features().removeIf(feature -> feature.minSupportedVersion() == 0);
   ```



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