guozhangwang commented on a change in pull request #10345:
URL: https://github.com/apache/kafka/pull/10345#discussion_r598954254



##########
File path: 
clients/src/main/java/org/apache/kafka/clients/consumer/internals/ConsumerCoordinator.java
##########
@@ -198,6 +198,7 @@ public ConsumerCoordinator(GroupRebalanceConfig 
rebalanceConfig,
             Collections.sort(supportedProtocols);
 
             protocol = supportedProtocols.get(supportedProtocols.size() - 1);
+            log.debug("Using rebalance protocol {}", protocol);

Review comment:
       nit: Initializing rebalance protocol to?

##########
File path: 
clients/src/main/java/org/apache/kafka/clients/consumer/internals/ConsumerCoordinator.java
##########
@@ -356,6 +357,23 @@ protected void onJoinComplete(int generation,
         if (assignor == null)
             throw new IllegalStateException("Coordinator selected invalid 
assignment protocol: " + assignmentStrategy);
 
+        log.debug("{} assignor selected by the group coordinator", assignor);
+
+        List<RebalanceProtocol> assignorSupportedProtocols = 
assignor.supportedProtocols();
+        Collections.sort(assignorSupportedProtocols);
+        RebalanceProtocol newProtocol = 
assignorSupportedProtocols.get(assignorSupportedProtocols.size() - 1);
+        if (newProtocol.id() < protocol.id()) {
+            log.error("Latest commonly supported rebalance protocol is {} 
which is lower than the current commonly supported rebalance protocol {}. "

Review comment:
       I think a more common error scenario is when a new member joining a 
group with ONLY old assignor in the configs, while all the existing members in 
the current generation have both old and new assignors. In this case the old 
would have to be selected.
   
   So in the error message, we should also clarify this case, e.g. saying 
something that "once a new protocol is selected, even though everyone still 
supports the old protocol it cannot be downgraded anymore --- even if a new 
member with only the old protocol joins the group"




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

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to