You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "dajac (via GitHub)" <gi...@apache.org> on 2023/04/11 11:10:17 UTC
[GitHub] [kafka] dajac opened a new pull request, #13537: KAFKA-14462; [7/N] Add ClientAssignor, Assignment, TopicMetadata and VersionedMetadata
dajac opened a new pull request, #13537:
URL: https://github.com/apache/kafka/pull/13537
Built on top of https://github.com/apache/kafka/pull/13536. This patch adds a few POJOs.
### Committer Checklist (excluded from commit message)
- [ ] Verify design and implementation
- [ ] Verify test coverage and CI build status
- [ ] Verify documentation (including upgrade notes)
--
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-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kafka] jolshan commented on a diff in pull request #13537: KAFKA-14462; [7/N] Add ClientAssignor, Assignment, TopicMetadata and VersionedMetadata
Posted by "jolshan (via GitHub)" <gi...@apache.org>.
jolshan commented on code in PR #13537:
URL: https://github.com/apache/kafka/pull/13537#discussion_r1171626201
##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/consumer/TopicMetadata.java:
##########
@@ -0,0 +1,109 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.coordinator.group.consumer;
+
+import org.apache.kafka.common.Uuid;
+import org.apache.kafka.coordinator.group.generated.ConsumerGroupPartitionMetadataValue;
+
+import java.util.Objects;
+
+public class TopicMetadata {
+ /**
+ * The topic id.
+ */
+ private final Uuid id;
+
+ /**
+ * The topic name.
+ */
+ private final String name;
+
+ /**
+ * The number of partitions.
+ */
+ private final int numPartitions;
+
+ public TopicMetadata(
+ Uuid id,
+ String name,
+ int numPartitions
+ ) {
+ this.id = Objects.requireNonNull(id);
Review Comment:
Do we want to allow the Uuid to be the zero uuid?
--
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-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kafka] jolshan commented on a diff in pull request #13537: KAFKA-14462; [7/N] Add ClientAssignor, Assignment, TopicMetadata and VersionedMetadata
Posted by "jolshan (via GitHub)" <gi...@apache.org>.
jolshan commented on code in PR #13537:
URL: https://github.com/apache/kafka/pull/13537#discussion_r1172939909
##########
group-coordinator/src/test/java/org/apache/kafka/coordinator/group/consumer/ClientAssignorTest.java:
##########
@@ -0,0 +1,133 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.coordinator.group.consumer;
+
+import org.apache.kafka.coordinator.group.generated.ConsumerGroupMemberMetadataValue;
+import org.junit.jupiter.api.Test;
+
+import java.nio.ByteBuffer;
+import java.nio.charset.StandardCharsets;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+public class ClientAssignorTest {
+
+ @Test
+ public void testNameAndMetadataCannotBeBull() {
Review Comment:
also did we want tests for some of the other errors we throw?
--
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-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kafka] dajac commented on a diff in pull request #13537: KAFKA-14462; [7/N] Add ClientAssignor, Assignment, TopicMetadata and VersionedMetadata
Posted by "dajac (via GitHub)" <gi...@apache.org>.
dajac commented on code in PR #13537:
URL: https://github.com/apache/kafka/pull/13537#discussion_r1172519824
##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/consumer/ClientAssignor.java:
##########
@@ -0,0 +1,150 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.coordinator.group.consumer;
+
+import org.apache.kafka.coordinator.group.generated.ConsumerGroupMemberMetadataValue;
+
+import java.nio.ByteBuffer;
+import java.util.Objects;
+
+/**
+ * An immutable representation of a client side assignor within a consumer group member.
+ */
+public class ClientAssignor {
+ /**
+ * The name of the assignor.
+ */
+ private final String name;
+
+ /**
+ * The reason reported by the assignor.
+ */
+ private final byte reason;
+
+ /**
+ * The minimum metadata version supported by the assignor.
+ */
+ private final short minimumVersion;
+
+ /**
+ * The maximum metadata version supported by the assignor.
+ */
+ private final short maximumVersion;
+
+ /**
+ * The versioned metadata.
+ */
+ private final VersionedMetadata metadata;
Review Comment:
correct but metadata flows via the protocol/coordinator.
--
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-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kafka] jolshan commented on a diff in pull request #13537: KAFKA-14462; [7/N] Add ClientAssignor, Assignment, TopicMetadata and VersionedMetadata
Posted by "jolshan (via GitHub)" <gi...@apache.org>.
jolshan commented on code in PR #13537:
URL: https://github.com/apache/kafka/pull/13537#discussion_r1172939142
##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/consumer/ClientAssignor.java:
##########
@@ -0,0 +1,150 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.coordinator.group.consumer;
+
+import org.apache.kafka.coordinator.group.generated.ConsumerGroupMemberMetadataValue;
+
+import java.nio.ByteBuffer;
+import java.util.Objects;
+
+/**
+ * An immutable representation of a client side assignor within a consumer group member.
+ */
+public class ClientAssignor {
+ /**
+ * The name of the assignor.
+ */
+ private final String name;
+
+ /**
+ * The reason reported by the assignor.
+ */
+ private final byte reason;
+
+ /**
+ * The minimum metadata version supported by the assignor.
+ */
+ private final short minimumVersion;
+
+ /**
+ * The maximum metadata version supported by the assignor.
+ */
+ private final short maximumVersion;
+
+ /**
+ * The versioned metadata.
+ */
+ private final VersionedMetadata metadata;
+
+ public ClientAssignor(
+ String name,
+ byte reason,
+ short minimumVersion,
+ short maximumVersion,
+ VersionedMetadata metadata
+ ) {
+ this.name = Objects.requireNonNull(name);
+ this.reason = reason;
+ this.minimumVersion = minimumVersion;
Review Comment:
There were a few others in other classes. Did we want to do the same for those?
--
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-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kafka] dajac merged pull request #13537: KAFKA-14462; [7/N] Add ClientAssignor, Assignment, TopicMetadata and VersionedMetadata
Posted by "dajac (via GitHub)" <gi...@apache.org>.
dajac merged PR #13537:
URL: https://github.com/apache/kafka/pull/13537
--
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-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kafka] dajac commented on a diff in pull request #13537: KAFKA-14462; [7/N] Add ClientAssignor, Assignment, TopicMetadata and VersionedMetadata
Posted by "dajac (via GitHub)" <gi...@apache.org>.
dajac commented on code in PR #13537:
URL: https://github.com/apache/kafka/pull/13537#discussion_r1172236944
##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/consumer/Assignment.java:
##########
@@ -0,0 +1,144 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.coordinator.group.consumer;
+
+import org.apache.kafka.common.Uuid;
+import org.apache.kafka.coordinator.group.generated.ConsumerGroupTargetAssignmentMemberValue;
+
+import java.nio.ByteBuffer;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+/**
+ * An immutable assignment for a member.
+ */
+public class Assignment {
+ public static final Assignment EMPTY = new Assignment(
+ (byte) 0,
+ Collections.emptyMap(),
+ VersionedMetadata.EMPTY
+ );
+
+ /**
+ * The error assigned to the member.
+ */
+ private final byte error;
+
+ /**
+ * The partitions assigned to the member.
+ */
+ private final Map<Uuid, Set<Integer>> partitions;
+
+ /**
+ * The metadata assigned to the member.
+ */
+ private final VersionedMetadata metadata;
+
+ public Assignment(
+ Map<Uuid, Set<Integer>> partitions
+ ) {
+ this(
+ (byte) 0,
+ partitions,
+ VersionedMetadata.EMPTY
+ );
+ }
+
+ public Assignment(
+ byte error,
+ Map<Uuid, Set<Integer>> partitions,
+ VersionedMetadata metadata
+ ) {
+ this.error = error;
+ this.partitions = Collections.unmodifiableMap(Objects.requireNonNull(partitions));
Review Comment:
I don't think so.
--
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-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kafka] jeffkbkim commented on a diff in pull request #13537: KAFKA-14462; [7/N] Add ClientAssignor, Assignment, TopicMetadata and VersionedMetadata
Posted by "jeffkbkim (via GitHub)" <gi...@apache.org>.
jeffkbkim commented on code in PR #13537:
URL: https://github.com/apache/kafka/pull/13537#discussion_r1172502546
##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/consumer/ClientAssignor.java:
##########
@@ -0,0 +1,150 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.coordinator.group.consumer;
+
+import org.apache.kafka.coordinator.group.generated.ConsumerGroupMemberMetadataValue;
+
+import java.nio.ByteBuffer;
+import java.util.Objects;
+
+/**
+ * An immutable representation of a client side assignor within a consumer group member.
+ */
+public class ClientAssignor {
+ /**
+ * The name of the assignor.
+ */
+ private final String name;
+
+ /**
+ * The reason reported by the assignor.
+ */
+ private final byte reason;
+
+ /**
+ * The minimum metadata version supported by the assignor.
+ */
+ private final short minimumVersion;
+
+ /**
+ * The maximum metadata version supported by the assignor.
+ */
+ private final short maximumVersion;
+
+ /**
+ * The versioned metadata.
+ */
+ private final VersionedMetadata metadata;
Review Comment:
to confirm, client assignor implementations will be under the `consumer` package?
--
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-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kafka] jolshan commented on a diff in pull request #13537: KAFKA-14462; [7/N] Add ClientAssignor, Assignment, TopicMetadata and VersionedMetadata
Posted by "jolshan (via GitHub)" <gi...@apache.org>.
jolshan commented on code in PR #13537:
URL: https://github.com/apache/kafka/pull/13537#discussion_r1171634759
##########
group-coordinator/src/test/java/org/apache/kafka/coordinator/group/consumer/AssignmentTest.java:
##########
@@ -0,0 +1,137 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.coordinator.group.consumer;
+
+import org.apache.kafka.common.Uuid;
+import org.apache.kafka.coordinator.group.generated.ConsumerGroupTargetAssignmentMemberValue;
+import org.junit.jupiter.api.Test;
+
+import java.nio.ByteBuffer;
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import static org.apache.kafka.coordinator.group.consumer.AssignmentTestUtil.mkAssignment;
+import static org.apache.kafka.coordinator.group.consumer.AssignmentTestUtil.mkTopicAssignment;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+public class AssignmentTest {
+
+ @Test
+ public void testPartitionsAndMetadataCannotBeNull() {
+ assertThrows(NullPointerException.class, () -> new Assignment(
+ (byte) 1,
+ null,
+ new VersionedMetadata(
+ (short) 1,
+ ByteBuffer.wrap("hello".getBytes(StandardCharsets.UTF_8))
+ )
+ ));
+
+ assertThrows(NullPointerException.class, () -> new Assignment(
+ (byte) 1,
+ mkAssignment(
+ mkTopicAssignment(Uuid.randomUuid(), 1, 2, 3)
+ ),
+ null
+ ));
+ }
+
+ @Test
+ public void testAttributes() {
+ Map<Uuid, Set<Integer>> partitions = mkAssignment(
+ mkTopicAssignment(Uuid.randomUuid(), 1, 2, 3)
+ );
+
+ VersionedMetadata metadata = new VersionedMetadata(
+ (short) 1,
+ ByteBuffer.wrap("hello".getBytes(StandardCharsets.UTF_8))
+ );
+
+ Assignment assignment = new Assignment(
+ (byte) 1,
+ partitions,
+ metadata
+ );
+
+ assertEquals((byte) 1, assignment.error());
+ assertEquals(partitions, assignment.partitions());
+ assertEquals(metadata, assignment.metadata());
+ }
+
+ @Test
+ public void testFromTargetAssignmentRecord() {
+ Uuid topicId1 = Uuid.randomUuid();
+ Uuid topicId2 = Uuid.randomUuid();
+
+ List<ConsumerGroupTargetAssignmentMemberValue.TopicPartition> partitions = new ArrayList<>();
+ partitions.add(new ConsumerGroupTargetAssignmentMemberValue.TopicPartition()
+ .setTopicId(topicId1)
+ .setPartitions(Arrays.asList(1, 2, 3)));
+ partitions.add(new ConsumerGroupTargetAssignmentMemberValue.TopicPartition()
+ .setTopicId(topicId2)
+ .setPartitions(Arrays.asList(4, 5, 6)));
+
+ ConsumerGroupTargetAssignmentMemberValue record = new ConsumerGroupTargetAssignmentMemberValue()
+ .setError((byte) 1)
+ .setTopicPartitions(partitions)
+ .setMetadataVersion((short) 2)
+ .setMetadataBytes("foo".getBytes(StandardCharsets.UTF_8));
+
+ Assignment assignment = Assignment.fromRecord(record);
+
+ assertEquals((short) 1, assignment.error());
+ assertEquals(mkAssignment(
+ mkTopicAssignment(topicId1, 1, 2, 3),
+ mkTopicAssignment(topicId2, 4, 5, 6)
+ ), assignment.partitions());
+ assertEquals(new VersionedMetadata(
+ (short) 2,
+ ByteBuffer.wrap("foo".getBytes(StandardCharsets.UTF_8))
+ ), assignment.metadata());
+ }
+
+ @Test
+ public void testEquals() {
Review Comment:
Did you want to have a notEquals for some of these testEquals?
--
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-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kafka] dajac commented on a diff in pull request #13537: KAFKA-14462; [7/N] Add ClientAssignor, Assignment, TopicMetadata and VersionedMetadata
Posted by "dajac (via GitHub)" <gi...@apache.org>.
dajac commented on code in PR #13537:
URL: https://github.com/apache/kafka/pull/13537#discussion_r1172243757
##########
group-coordinator/src/test/java/org/apache/kafka/coordinator/group/consumer/AssignmentTest.java:
##########
@@ -0,0 +1,137 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.coordinator.group.consumer;
+
+import org.apache.kafka.common.Uuid;
+import org.apache.kafka.coordinator.group.generated.ConsumerGroupTargetAssignmentMemberValue;
+import org.junit.jupiter.api.Test;
+
+import java.nio.ByteBuffer;
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import static org.apache.kafka.coordinator.group.consumer.AssignmentTestUtil.mkAssignment;
+import static org.apache.kafka.coordinator.group.consumer.AssignmentTestUtil.mkTopicAssignment;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+public class AssignmentTest {
+
+ @Test
+ public void testPartitionsAndMetadataCannotBeNull() {
+ assertThrows(NullPointerException.class, () -> new Assignment(
+ (byte) 1,
+ null,
+ new VersionedMetadata(
+ (short) 1,
+ ByteBuffer.wrap("hello".getBytes(StandardCharsets.UTF_8))
+ )
+ ));
+
+ assertThrows(NullPointerException.class, () -> new Assignment(
+ (byte) 1,
+ mkAssignment(
+ mkTopicAssignment(Uuid.randomUuid(), 1, 2, 3)
+ ),
+ null
+ ));
+ }
+
+ @Test
+ public void testAttributes() {
+ Map<Uuid, Set<Integer>> partitions = mkAssignment(
+ mkTopicAssignment(Uuid.randomUuid(), 1, 2, 3)
+ );
+
+ VersionedMetadata metadata = new VersionedMetadata(
+ (short) 1,
+ ByteBuffer.wrap("hello".getBytes(StandardCharsets.UTF_8))
+ );
+
+ Assignment assignment = new Assignment(
+ (byte) 1,
+ partitions,
+ metadata
+ );
+
+ assertEquals((byte) 1, assignment.error());
+ assertEquals(partitions, assignment.partitions());
+ assertEquals(metadata, assignment.metadata());
+ }
+
+ @Test
+ public void testFromTargetAssignmentRecord() {
+ Uuid topicId1 = Uuid.randomUuid();
+ Uuid topicId2 = Uuid.randomUuid();
+
+ List<ConsumerGroupTargetAssignmentMemberValue.TopicPartition> partitions = new ArrayList<>();
+ partitions.add(new ConsumerGroupTargetAssignmentMemberValue.TopicPartition()
+ .setTopicId(topicId1)
+ .setPartitions(Arrays.asList(1, 2, 3)));
+ partitions.add(new ConsumerGroupTargetAssignmentMemberValue.TopicPartition()
+ .setTopicId(topicId2)
+ .setPartitions(Arrays.asList(4, 5, 6)));
+
+ ConsumerGroupTargetAssignmentMemberValue record = new ConsumerGroupTargetAssignmentMemberValue()
+ .setError((byte) 1)
+ .setTopicPartitions(partitions)
+ .setMetadataVersion((short) 2)
+ .setMetadataBytes("foo".getBytes(StandardCharsets.UTF_8));
+
+ Assignment assignment = Assignment.fromRecord(record);
+
+ assertEquals((short) 1, assignment.error());
+ assertEquals(mkAssignment(
+ mkTopicAssignment(topicId1, 1, 2, 3),
+ mkTopicAssignment(topicId2, 4, 5, 6)
+ ), assignment.partitions());
+ assertEquals(new VersionedMetadata(
+ (short) 2,
+ ByteBuffer.wrap("foo".getBytes(StandardCharsets.UTF_8))
+ ), assignment.metadata());
+ }
+
+ @Test
+ public void testEquals() {
Review Comment:
Added some for completeness.
--
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-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kafka] dajac commented on a diff in pull request #13537: KAFKA-14462; [7/N] Add ClientAssignor, Assignment, TopicMetadata and VersionedMetadata
Posted by "dajac (via GitHub)" <gi...@apache.org>.
dajac commented on code in PR #13537:
URL: https://github.com/apache/kafka/pull/13537#discussion_r1172946358
##########
group-coordinator/src/test/java/org/apache/kafka/coordinator/group/consumer/ClientAssignorTest.java:
##########
@@ -0,0 +1,133 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.coordinator.group.consumer;
+
+import org.apache.kafka.coordinator.group.generated.ConsumerGroupMemberMetadataValue;
+import org.junit.jupiter.api.Test;
+
+import java.nio.ByteBuffer;
+import java.nio.charset.StandardCharsets;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+public class ClientAssignorTest {
+
+ @Test
+ public void testNameAndMetadataCannotBeBull() {
Review Comment:
This is not necessary in my opinion.
--
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-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kafka] jeffkbkim commented on a diff in pull request #13537: KAFKA-14462; [7/N] Add ClientAssignor, Assignment, TopicMetadata and VersionedMetadata
Posted by "jeffkbkim (via GitHub)" <gi...@apache.org>.
jeffkbkim commented on code in PR #13537:
URL: https://github.com/apache/kafka/pull/13537#discussion_r1172529291
##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/consumer/ClientAssignor.java:
##########
@@ -0,0 +1,150 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.coordinator.group.consumer;
+
+import org.apache.kafka.coordinator.group.generated.ConsumerGroupMemberMetadataValue;
+
+import java.nio.ByteBuffer;
+import java.util.Objects;
+
+/**
+ * An immutable representation of a client side assignor within a consumer group member.
+ */
+public class ClientAssignor {
+ /**
+ * The name of the assignor.
+ */
+ private final String name;
+
+ /**
+ * The reason reported by the assignor.
+ */
+ private final byte reason;
+
+ /**
+ * The minimum metadata version supported by the assignor.
+ */
+ private final short minimumVersion;
+
+ /**
+ * The maximum metadata version supported by the assignor.
+ */
+ private final short maximumVersion;
+
+ /**
+ * The versioned metadata.
+ */
+ private final VersionedMetadata metadata;
Review Comment:
can we add a short description that the `error` and `metadata` are used by the client assignor? having assignment/metadata in bytes in the current coordinator made it hard for me to understand personally
--
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-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kafka] jolshan commented on a diff in pull request #13537: KAFKA-14462; [7/N] Add ClientAssignor, Assignment, TopicMetadata and VersionedMetadata
Posted by "jolshan (via GitHub)" <gi...@apache.org>.
jolshan commented on code in PR #13537:
URL: https://github.com/apache/kafka/pull/13537#discussion_r1171626917
##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/consumer/TopicMetadata.java:
##########
@@ -0,0 +1,109 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.coordinator.group.consumer;
+
+import org.apache.kafka.common.Uuid;
+import org.apache.kafka.coordinator.group.generated.ConsumerGroupPartitionMetadataValue;
+
+import java.util.Objects;
+
+public class TopicMetadata {
Review Comment:
Did we want a describing comment? I think this is fairly self-explanatory, but all the other classes had 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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kafka] dajac commented on a diff in pull request #13537: KAFKA-14462; [7/N] Add ClientAssignor, Assignment, TopicMetadata and VersionedMetadata
Posted by "dajac (via GitHub)" <gi...@apache.org>.
dajac commented on code in PR #13537:
URL: https://github.com/apache/kafka/pull/13537#discussion_r1172252094
##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/consumer/Assignment.java:
##########
@@ -0,0 +1,144 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.coordinator.group.consumer;
+
+import org.apache.kafka.common.Uuid;
+import org.apache.kafka.coordinator.group.generated.ConsumerGroupTargetAssignmentMemberValue;
+
+import java.nio.ByteBuffer;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+/**
+ * An immutable assignment for a member.
+ */
+public class Assignment {
+ public static final Assignment EMPTY = new Assignment(
+ (byte) 0,
+ Collections.emptyMap(),
+ VersionedMetadata.EMPTY
+ );
+
+ /**
+ * The error assigned to the member.
+ */
+ private final byte error;
Review Comment:
It could by anything. This depends on the implementation of the client side assignor. You have a few examples for Streams [here](https://cwiki.apache.org/confluence/display/KAFKA/KIP-848%3A+The+Next+Generation+of+the+Consumer+Rebalance+Protocol#KIP848:TheNextGenerationoftheConsumerRebalanceProtocol-AssignmentMetadataErrors).
--
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-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kafka] dajac commented on a diff in pull request #13537: KAFKA-14462; [7/N] Add ClientAssignor, Assignment, TopicMetadata and VersionedMetadata
Posted by "dajac (via GitHub)" <gi...@apache.org>.
dajac commented on code in PR #13537:
URL: https://github.com/apache/kafka/pull/13537#discussion_r1172621475
##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/consumer/ClientAssignor.java:
##########
@@ -0,0 +1,150 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.coordinator.group.consumer;
+
+import org.apache.kafka.coordinator.group.generated.ConsumerGroupMemberMetadataValue;
+
+import java.nio.ByteBuffer;
+import java.util.Objects;
+
+/**
+ * An immutable representation of a client side assignor within a consumer group member.
+ */
+public class ClientAssignor {
+ /**
+ * The name of the assignor.
+ */
+ private final String name;
+
+ /**
+ * The reason reported by the assignor.
+ */
+ private final byte reason;
+
+ /**
+ * The minimum metadata version supported by the assignor.
+ */
+ private final short minimumVersion;
+
+ /**
+ * The maximum metadata version supported by the assignor.
+ */
+ private final short maximumVersion;
+
+ /**
+ * The versioned metadata.
+ */
+ private final VersionedMetadata metadata;
Review Comment:
```
/**
* The error assigned to the member.
*/
private final byte error;
```
you mean more than this?
--
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-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kafka] dajac commented on pull request #13537: KAFKA-14462; [7/N] Add ClientAssignor, Assignment, TopicMetadata and VersionedMetadata
Posted by "dajac (via GitHub)" <gi...@apache.org>.
dajac commented on PR #13537:
URL: https://github.com/apache/kafka/pull/13537#issuecomment-1515931229
@jolshan @jeffkbkim Thanks for your comments. I have addressed 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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kafka] jeffkbkim commented on a diff in pull request #13537: KAFKA-14462; [7/N] Add ClientAssignor, Assignment, TopicMetadata and VersionedMetadata
Posted by "jeffkbkim (via GitHub)" <gi...@apache.org>.
jeffkbkim commented on code in PR #13537:
URL: https://github.com/apache/kafka/pull/13537#discussion_r1171626106
##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/consumer/VersionedMetadata.java:
##########
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.coordinator.group.consumer;
+
+import java.nio.ByteBuffer;
+import java.util.Objects;
+
+/**
+ * Immutable versioned metadata.
+ */
+public class VersionedMetadata {
+ public static final VersionedMetadata EMPTY = new VersionedMetadata((short) 0, ByteBuffer.allocate(0));
+
+ /**
+ * The version of the metadata encoded in {{@link VersionedMetadata#metadata}}.
+ */
+ private final short version;
+
+ /**
+ * The metadata bytes.
+ */
+ private final ByteBuffer metadata;
Review Comment:
is this is what's stored by the consumer?
##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/consumer/VersionedMetadata.java:
##########
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.coordinator.group.consumer;
+
+import java.nio.ByteBuffer;
+import java.util.Objects;
+
+/**
+ * Immutable versioned metadata.
Review Comment:
can we add more description on what is stored inside the metadata and how it's used?
##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/consumer/Assignment.java:
##########
@@ -0,0 +1,144 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.coordinator.group.consumer;
+
+import org.apache.kafka.common.Uuid;
+import org.apache.kafka.coordinator.group.generated.ConsumerGroupTargetAssignmentMemberValue;
+
+import java.nio.ByteBuffer;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+/**
+ * An immutable assignment for a member.
+ */
+public class Assignment {
+ public static final Assignment EMPTY = new Assignment(
+ (byte) 0,
+ Collections.emptyMap(),
+ VersionedMetadata.EMPTY
+ );
+
+ /**
+ * The error assigned to the member.
+ */
+ private final byte error;
Review Comment:
what would be an example for an error?
##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/consumer/ClientAssignor.java:
##########
@@ -0,0 +1,150 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.coordinator.group.consumer;
+
+import org.apache.kafka.coordinator.group.generated.ConsumerGroupMemberMetadataValue;
+
+import java.nio.ByteBuffer;
+import java.util.Objects;
+
+/**
+ * An immutable representation of a client side assignor within a consumer group member.
+ */
+public class ClientAssignor {
+ /**
+ * The name of the assignor.
+ */
+ private final String name;
+
+ /**
+ * The reason reported by the assignor.
+ */
+ private final byte reason;
+
+ /**
+ * The minimum metadata version supported by the assignor.
+ */
+ private final short minimumVersion;
+
+ /**
+ * The maximum metadata version supported by the assignor.
+ */
+ private final short maximumVersion;
+
+ /**
+ * The versioned metadata.
+ */
+ private final VersionedMetadata metadata;
Review Comment:
what's an example of a metadata stored inside the client assignor?
--
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-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kafka] dajac commented on pull request #13537: KAFKA-14462; [7/N] Add ClientAssignor, Assignment, TopicMetadata and VersionedMetadata
Posted by "dajac (via GitHub)" <gi...@apache.org>.
dajac commented on PR #13537:
URL: https://github.com/apache/kafka/pull/13537#issuecomment-1508440940
@clolov Thanks for the comments. I have addressed them while rebasing the PR.
--
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-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kafka] dajac commented on a diff in pull request #13537: KAFKA-14462; [7/N] Add ClientAssignor, Assignment, TopicMetadata and VersionedMetadata
Posted by "dajac (via GitHub)" <gi...@apache.org>.
dajac commented on code in PR #13537:
URL: https://github.com/apache/kafka/pull/13537#discussion_r1172945841
##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/consumer/ClientAssignor.java:
##########
@@ -0,0 +1,150 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.coordinator.group.consumer;
+
+import org.apache.kafka.coordinator.group.generated.ConsumerGroupMemberMetadataValue;
+
+import java.nio.ByteBuffer;
+import java.util.Objects;
+
+/**
+ * An immutable representation of a client side assignor within a consumer group member.
+ */
+public class ClientAssignor {
+ /**
+ * The name of the assignor.
+ */
+ private final String name;
+
+ /**
+ * The reason reported by the assignor.
+ */
+ private final byte reason;
+
+ /**
+ * The minimum metadata version supported by the assignor.
+ */
+ private final short minimumVersion;
+
+ /**
+ * The maximum metadata version supported by the assignor.
+ */
+ private final short maximumVersion;
+
+ /**
+ * The versioned metadata.
+ */
+ private final VersionedMetadata metadata;
+
+ public ClientAssignor(
+ String name,
+ byte reason,
+ short minimumVersion,
+ short maximumVersion,
+ VersionedMetadata metadata
+ ) {
+ this.name = Objects.requireNonNull(name);
+ this.reason = reason;
+ this.minimumVersion = minimumVersion;
Review Comment:
I think that I have added the ones where relevant.
--
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-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kafka] jeffkbkim commented on a diff in pull request #13537: KAFKA-14462; [7/N] Add ClientAssignor, Assignment, TopicMetadata and VersionedMetadata
Posted by "jeffkbkim (via GitHub)" <gi...@apache.org>.
jeffkbkim commented on code in PR #13537:
URL: https://github.com/apache/kafka/pull/13537#discussion_r1172600639
##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/consumer/ClientAssignor.java:
##########
@@ -0,0 +1,150 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.coordinator.group.consumer;
+
+import org.apache.kafka.coordinator.group.generated.ConsumerGroupMemberMetadataValue;
+
+import java.nio.ByteBuffer;
+import java.util.Objects;
+
+/**
+ * An immutable representation of a client side assignor within a consumer group member.
+ */
+public class ClientAssignor {
+ /**
+ * The name of the assignor.
+ */
+ private final String name;
+
+ /**
+ * The reason reported by the assignor.
+ */
+ private final byte reason;
+
+ /**
+ * The minimum metadata version supported by the assignor.
+ */
+ private final short minimumVersion;
+
+ /**
+ * The maximum metadata version supported by the assignor.
+ */
+ private final short maximumVersion;
+
+ /**
+ * The versioned metadata.
+ */
+ private final VersionedMetadata metadata;
Review Comment:
that makes sense, and we added information inside VersionedMetadata. can we have a description for Assignment.error?
--
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-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kafka] jeffkbkim commented on a diff in pull request #13537: KAFKA-14462; [7/N] Add ClientAssignor, Assignment, TopicMetadata and VersionedMetadata
Posted by "jeffkbkim (via GitHub)" <gi...@apache.org>.
jeffkbkim commented on code in PR #13537:
URL: https://github.com/apache/kafka/pull/13537#discussion_r1172953390
##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/consumer/ClientAssignor.java:
##########
@@ -0,0 +1,150 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.coordinator.group.consumer;
+
+import org.apache.kafka.coordinator.group.generated.ConsumerGroupMemberMetadataValue;
+
+import java.nio.ByteBuffer;
+import java.util.Objects;
+
+/**
+ * An immutable representation of a client side assignor within a consumer group member.
+ */
+public class ClientAssignor {
+ /**
+ * The name of the assignor.
+ */
+ private final String name;
+
+ /**
+ * The reason reported by the assignor.
+ */
+ private final byte reason;
+
+ /**
+ * The minimum metadata version supported by the assignor.
+ */
+ private final short minimumVersion;
+
+ /**
+ * The maximum metadata version supported by the assignor.
+ */
+ private final short maximumVersion;
+
+ /**
+ * The versioned metadata.
+ */
+ private final VersionedMetadata metadata;
Review Comment:
sorry to have hijacked this thread, but something like
```
/**
* The error assigned to the member. Depends on the client assignor
* implementation and commonly used for Streams
*/
private final byte error;
```
if you think what we have is sufficient, i am fine with it. just wanted to mention that i didn't fully understand how it would be used
--
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-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kafka] dajac commented on a diff in pull request #13537: KAFKA-14462; [7/N] Add ClientAssignor, Assignment, TopicMetadata and VersionedMetadata
Posted by "dajac (via GitHub)" <gi...@apache.org>.
dajac commented on code in PR #13537:
URL: https://github.com/apache/kafka/pull/13537#discussion_r1172250882
##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/consumer/VersionedMetadata.java:
##########
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.coordinator.group.consumer;
+
+import java.nio.ByteBuffer;
+import java.util.Objects;
+
+/**
+ * Immutable versioned metadata.
+ */
+public class VersionedMetadata {
+ public static final VersionedMetadata EMPTY = new VersionedMetadata((short) 0, ByteBuffer.allocate(0));
+
+ /**
+ * The version of the metadata encoded in {{@link VersionedMetadata#metadata}}.
+ */
+ private final short version;
+
+ /**
+ * The metadata bytes.
+ */
+ private final ByteBuffer metadata;
Review Comment:
It depends on the context. This is used by client side assignors in two ways: 1) The member reports its metadata to the assignor; and 2) the assignor defines metadata for the members in the assignment.
--
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-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kafka] dajac commented on a diff in pull request #13537: KAFKA-14462; [7/N] Add ClientAssignor, Assignment, TopicMetadata and VersionedMetadata
Posted by "dajac (via GitHub)" <gi...@apache.org>.
dajac commented on code in PR #13537:
URL: https://github.com/apache/kafka/pull/13537#discussion_r1172253675
##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/consumer/ClientAssignor.java:
##########
@@ -0,0 +1,150 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.coordinator.group.consumer;
+
+import org.apache.kafka.coordinator.group.generated.ConsumerGroupMemberMetadataValue;
+
+import java.nio.ByteBuffer;
+import java.util.Objects;
+
+/**
+ * An immutable representation of a client side assignor within a consumer group member.
+ */
+public class ClientAssignor {
+ /**
+ * The name of the assignor.
+ */
+ private final String name;
+
+ /**
+ * The reason reported by the assignor.
+ */
+ private final byte reason;
+
+ /**
+ * The minimum metadata version supported by the assignor.
+ */
+ private final short minimumVersion;
+
+ /**
+ * The maximum metadata version supported by the assignor.
+ */
+ private final short maximumVersion;
+
+ /**
+ * The versioned metadata.
+ */
+ private final VersionedMetadata metadata;
Review Comment:
This is not defined and left to the implementation of the assignor. The foreseen schema for Streams are defined [here](https://cwiki.apache.org/confluence/display/KAFKA/KIP-848%3A+The+Next+Generation+of+the+Consumer+Rebalance+Protocol#KIP848:TheNextGenerationoftheConsumerRebalanceProtocol-StreamsMemberMetadataandAssignmentMetadata).
--
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-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kafka] dajac commented on a diff in pull request #13537: KAFKA-14462; [7/N] Add ClientAssignor, Assignment, TopicMetadata and VersionedMetadata
Posted by "dajac (via GitHub)" <gi...@apache.org>.
dajac commented on code in PR #13537:
URL: https://github.com/apache/kafka/pull/13537#discussion_r1172227215
##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/consumer/TopicMetadata.java:
##########
@@ -0,0 +1,109 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.coordinator.group.consumer;
+
+import org.apache.kafka.common.Uuid;
+import org.apache.kafka.coordinator.group.generated.ConsumerGroupPartitionMetadataValue;
+
+import java.util.Objects;
+
+public class TopicMetadata {
+ /**
+ * The topic id.
+ */
+ private final Uuid id;
+
+ /**
+ * The topic name.
+ */
+ private final String name;
+
+ /**
+ * The number of partitions.
+ */
+ private final int numPartitions;
+
+ public TopicMetadata(
+ Uuid id,
+ String name,
+ int numPartitions
+ ) {
+ this.id = Objects.requireNonNull(id);
Review Comment:
It should not be zero. Let me add a check.
##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/consumer/TopicMetadata.java:
##########
@@ -0,0 +1,109 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.coordinator.group.consumer;
+
+import org.apache.kafka.common.Uuid;
+import org.apache.kafka.coordinator.group.generated.ConsumerGroupPartitionMetadataValue;
+
+import java.util.Objects;
+
+public class TopicMetadata {
Review Comment:
Sure.
--
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-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kafka] jolshan commented on a diff in pull request #13537: KAFKA-14462; [7/N] Add ClientAssignor, Assignment, TopicMetadata and VersionedMetadata
Posted by "jolshan (via GitHub)" <gi...@apache.org>.
jolshan commented on code in PR #13537:
URL: https://github.com/apache/kafka/pull/13537#discussion_r1171628212
##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/consumer/ClientAssignor.java:
##########
@@ -0,0 +1,150 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.coordinator.group.consumer;
+
+import org.apache.kafka.coordinator.group.generated.ConsumerGroupMemberMetadataValue;
+
+import java.nio.ByteBuffer;
+import java.util.Objects;
+
+/**
+ * An immutable representation of a client side assignor within a consumer group member.
+ */
+public class ClientAssignor {
+ /**
+ * The name of the assignor.
+ */
+ private final String name;
+
+ /**
+ * The reason reported by the assignor.
+ */
+ private final byte reason;
+
+ /**
+ * The minimum metadata version supported by the assignor.
+ */
+ private final short minimumVersion;
+
+ /**
+ * The maximum metadata version supported by the assignor.
+ */
+ private final short maximumVersion;
+
+ /**
+ * The versioned metadata.
+ */
+ private final VersionedMetadata metadata;
+
+ public ClientAssignor(
+ String name,
+ byte reason,
+ short minimumVersion,
+ short maximumVersion,
+ VersionedMetadata metadata
+ ) {
+ this.name = Objects.requireNonNull(name);
+ this.reason = reason;
+ this.minimumVersion = minimumVersion;
Review Comment:
for some of the version fields (maybe errors too) did we want to specify non-negative? It's probably not as crucial as specifying non-null though.
--
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-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kafka] clolov commented on a diff in pull request #13537: KAFKA-14462; [7/N] Add ClientAssignor, Assignment, TopicMetadata and VersionedMetadata
Posted by "clolov (via GitHub)" <gi...@apache.org>.
clolov commented on code in PR #13537:
URL: https://github.com/apache/kafka/pull/13537#discussion_r1165179192
##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/consumer/Assignment.java:
##########
@@ -0,0 +1,144 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.coordinator.group.consumer;
+
+import org.apache.kafka.common.Uuid;
+import org.apache.kafka.coordinator.group.generated.ConsumerGroupTargetAssignmentMemberValue;
+
+import java.nio.ByteBuffer;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+/**
+ * A immutable assignment for a member.
Review Comment:
```suggestion
* An immutable assignment for a member.
```
##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/consumer/ClientAssignor.java:
##########
@@ -0,0 +1,150 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.coordinator.group.consumer;
+
+import org.apache.kafka.coordinator.group.generated.ConsumerGroupMemberMetadataValue;
+
+import java.nio.ByteBuffer;
+import java.util.Objects;
+
+/**
+ * An immutable representation of an client side assignor within a consumer group member.
Review Comment:
```suggestion
* An immutable representation of a client side assignor within a consumer group member.
```
##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/consumer/ClientAssignor.java:
##########
@@ -0,0 +1,150 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.coordinator.group.consumer;
+
+import org.apache.kafka.coordinator.group.generated.ConsumerGroupMemberMetadataValue;
+
+import java.nio.ByteBuffer;
+import java.util.Objects;
+
+/**
+ * An immutable representation of an client side assignor within a consumer group member.
+ */
+public class ClientAssignor {
+ /**
+ * The name of the assignor.
+ */
+ private final String name;
+
+ /**
+ * The reason reported by the assignor.
+ */
+ private final byte reason;
+
+ /**
+ * The minimum metadata version supported by the assignor.
+ */
+ private final short minimumVersion;
+
+ /**
+ * The maximum metadata version supported by the assignor.
+ */
+ private final short maximumVersion;
+
+ /**
+ * The versioned metadata.
+ */
+ private final VersionedMetadata metadata;
+
+ public ClientAssignor(
+ String name,
+ byte reason,
+ short minimumVersion,
+ short maximumVersion,
+ VersionedMetadata metadata
+ ) {
+ this.name = Objects.requireNonNull(name);
Review Comment:
All of Assignment, ClientAssignor, TopicMetadata and VersionedMetadata have requirements for some of the arguments to not be null. As far as I can see the tests which check that a exceptions are being thrown are those in TopicMetadataTest and VersionedMetadataTest. As a very small change I would request that we carry out such tests for the Assignment and the Client Assignor as well.
--
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-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kafka] jolshan commented on a diff in pull request #13537: KAFKA-14462; [7/N] Add ClientAssignor, Assignment, TopicMetadata and VersionedMetadata
Posted by "jolshan (via GitHub)" <gi...@apache.org>.
jolshan commented on code in PR #13537:
URL: https://github.com/apache/kafka/pull/13537#discussion_r1172939598
##########
group-coordinator/src/test/java/org/apache/kafka/coordinator/group/consumer/ClientAssignorTest.java:
##########
@@ -0,0 +1,133 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.coordinator.group.consumer;
+
+import org.apache.kafka.coordinator.group.generated.ConsumerGroupMemberMetadataValue;
+import org.junit.jupiter.api.Test;
+
+import java.nio.ByteBuffer;
+import java.nio.charset.StandardCharsets;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+public class ClientAssignorTest {
+
+ @Test
+ public void testNameAndMetadataCannotBeBull() {
Review Comment:
nit: Null
--
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-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kafka] dajac commented on a diff in pull request #13537: KAFKA-14462; [7/N] Add ClientAssignor, Assignment, TopicMetadata and VersionedMetadata
Posted by "dajac (via GitHub)" <gi...@apache.org>.
dajac commented on code in PR #13537:
URL: https://github.com/apache/kafka/pull/13537#discussion_r1172597532
##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/consumer/ClientAssignor.java:
##########
@@ -0,0 +1,150 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.coordinator.group.consumer;
+
+import org.apache.kafka.coordinator.group.generated.ConsumerGroupMemberMetadataValue;
+
+import java.nio.ByteBuffer;
+import java.util.Objects;
+
+/**
+ * An immutable representation of a client side assignor within a consumer group member.
+ */
+public class ClientAssignor {
+ /**
+ * The name of the assignor.
+ */
+ private final String name;
+
+ /**
+ * The reason reported by the assignor.
+ */
+ private final byte reason;
+
+ /**
+ * The minimum metadata version supported by the assignor.
+ */
+ private final short minimumVersion;
+
+ /**
+ * The maximum metadata version supported by the assignor.
+ */
+ private final short maximumVersion;
+
+ /**
+ * The versioned metadata.
+ */
+ private final VersionedMetadata metadata;
Review Comment:
I am not sure to understand what you would like to see. `ClientAssignor` is all about the client assignor so everything in this class is about this.
--
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-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kafka] dajac commented on pull request #13537: KAFKA-14462; [7/N] Add ClientAssignor, Assignment, TopicMetadata and VersionedMetadata
Posted by "dajac (via GitHub)" <gi...@apache.org>.
dajac commented on PR #13537:
URL: https://github.com/apache/kafka/pull/13537#issuecomment-1515007003
@dengziming @showuon I have a few PRs in-flight for KIP-848 if you are interested to help with reviews on that front.
--
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-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [kafka] jolshan commented on a diff in pull request #13537: KAFKA-14462; [7/N] Add ClientAssignor, Assignment, TopicMetadata and VersionedMetadata
Posted by "jolshan (via GitHub)" <gi...@apache.org>.
jolshan commented on code in PR #13537:
URL: https://github.com/apache/kafka/pull/13537#discussion_r1171629591
##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/consumer/Assignment.java:
##########
@@ -0,0 +1,144 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.coordinator.group.consumer;
+
+import org.apache.kafka.common.Uuid;
+import org.apache.kafka.coordinator.group.generated.ConsumerGroupTargetAssignmentMemberValue;
+
+import java.nio.ByteBuffer;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+/**
+ * An immutable assignment for a member.
+ */
+public class Assignment {
+ public static final Assignment EMPTY = new Assignment(
+ (byte) 0,
+ Collections.emptyMap(),
+ VersionedMetadata.EMPTY
+ );
+
+ /**
+ * The error assigned to the member.
+ */
+ private final byte error;
+
+ /**
+ * The partitions assigned to the member.
+ */
+ private final Map<Uuid, Set<Integer>> partitions;
+
+ /**
+ * The metadata assigned to the member.
+ */
+ private final VersionedMetadata metadata;
+
+ public Assignment(
+ Map<Uuid, Set<Integer>> partitions
+ ) {
+ this(
+ (byte) 0,
+ partitions,
+ VersionedMetadata.EMPTY
+ );
+ }
+
+ public Assignment(
+ byte error,
+ Map<Uuid, Set<Integer>> partitions,
+ VersionedMetadata metadata
+ ) {
+ this.error = error;
+ this.partitions = Collections.unmodifiableMap(Objects.requireNonNull(partitions));
Review Comment:
Are we concerned about the contents of the map being null?
--
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-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org