lianetm commented on code in PR #18649:
URL: https://github.com/apache/kafka/pull/18649#discussion_r1924239073


##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/GroupMetadataManager.java:
##########
@@ -846,28 +846,29 @@ private ShareGroup getOrMaybeCreateShareGroup(
 
         if (group == null) {
             return new ShareGroup(snapshotRegistry, groupId);
+        } else {
+            if (group.type() == SHARE) {
+                return (ShareGroup) group;
+            } else {
+                // We don't support upgrading/downgrading between protocols at 
the moment so
+                // we throw an exception if a group exists with the wrong type.
+                throw new GroupIdNotFoundException(String.format("Group %s is 
not a share group.", groupId));
+            }
         }
-
-        if (group.type() != SHARE) {
-            // We don't support upgrading/downgrading between protocols at the 
moment so
-            // we throw an exception if a group exists with the wrong type.
-            throw new GroupIdNotFoundException(String.format("Group %s is not 
a share group.",
-                groupId));
-        }
-
-        return (ShareGroup) group;
     }
 
     /**
-     * Gets or maybe creates a share group.
+     * The method should be called on the replay path.
+     * Gets or maybe creates a share group and updates the groups map if a new 
group is created.
      *
      * @param groupId           The group id.
      * @param createIfNotExists A boolean indicating whether the group should 
be
      *                          created if it does not exist.
      *
      * @return A ShareGroup.
      * @throws GroupIdNotFoundException if the group does not exist and 
createIfNotExists is false or
-     *                                  if the group is not a consumer group.
+     *                                  if the group is not a share group.

Review Comment:
   we should remove this here as it's not true anymore, right? (if not a share 
group it throws IllegalState)



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