dajac commented on code in PR #22356:
URL: https://github.com/apache/kafka/pull/22356#discussion_r3312249456
##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/GroupMetadataManager.java:
##########
Review Comment:
I think that we should address it here so we can get rid of
`throwIfConsumerGroupIsFull(group, memberId)`. Is there a strong reason for not
doing it?
##########
group-coordinator/src/test/java/org/apache/kafka/coordinator/group/GroupMetadataManagerTest.java:
##########
@@ -3897,6 +3897,174 @@ barTopicName, computeTopicHash(barTopicName,
metadataImage)
.setTopicPartitions(List.of())));
}
+ @Test
+ public void testStaticMemberCanRejoinWhenConsumerGroupIsFull() {
+ String groupId = "fooup";
+ String instanceId = "instance-id";
+ String oldMemberId = "old-member-id";
+ String newMemberId = "new-member-id";
+ int groupMaxSize = 1;
+
+ Uuid fooTopicId = Uuid.randomUuid();
+ String fooTopicName = "foo";
+
+ CoordinatorMetadataImage metadataImage = new MetadataImageBuilder()
+ .addTopic(fooTopicId, fooTopicName, 1)
+ .buildCoordinatorMetadataImage();
+
+ MockPartitionAssignor assignor = new MockPartitionAssignor("range");
+ assignor.prepareGroupAssignment(new GroupAssignment(Map.of(
+ newMemberId, new
MemberAssignmentImpl(mkAssignment(mkTopicAssignment(fooTopicId, 0))))));
Review Comment:
nit: Let's format it as follow as per existing style:
```
assignor.prepareGroupAssignment(new GroupAssignment(Map.of(
newMemberId, new
MemberAssignmentImpl(mkAssignment(mkTopicAssignment(fooTopicId, 0)))
)));
```
##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/GroupMetadataManager.java:
##########
@@ -1564,6 +1564,37 @@ private void throwIfConsumerGroupIsFull(
}
}
+ /**
+ * Checks whether the consumer group can accept a new member or not based
on the
+ * max group size defined.
+ *
+ * @param group The consumer group.
+ * @param memberId The member id.
+ * @param instanceId The instance Id.
+ *
+ * @throws GroupMaxSizeReachedException if the maximum capacity has been
reached.
+ */
+ private void throwIfConsumerGroupIsFull(
+ ConsumerGroup group,
+ String memberId,
+ String instanceId
Review Comment:
nit: We usually 4 spaces to indent code.
##########
group-coordinator/src/test/java/org/apache/kafka/coordinator/group/GroupMetadataManagerTest.java:
##########
@@ -3897,6 +3897,174 @@ barTopicName, computeTopicHash(barTopicName,
metadataImage)
.setTopicPartitions(List.of())));
}
+ @Test
+ public void testStaticMemberCanRejoinWhenConsumerGroupIsFull() {
+ String groupId = "fooup";
+ String instanceId = "instance-id";
+ String oldMemberId = "old-member-id";
+ String newMemberId = "new-member-id";
+ int groupMaxSize = 1;
+
+ Uuid fooTopicId = Uuid.randomUuid();
+ String fooTopicName = "foo";
+
+ CoordinatorMetadataImage metadataImage = new MetadataImageBuilder()
+ .addTopic(fooTopicId, fooTopicName, 1)
+ .buildCoordinatorMetadataImage();
Review Comment:
nit: 4 spaces. There are many other cases. I let you check them and fix them.
--
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]