AndrewJSchofield commented on code in PR #17011:
URL: https://github.com/apache/kafka/pull/17011#discussion_r1739913110


##########
core/src/main/scala/kafka/server/KafkaApis.scala:
##########
@@ -35,7 +35,7 @@ import org.apache.kafka.common.acl.AclOperation
 import org.apache.kafka.common.acl.AclOperation._
 import org.apache.kafka.common.config.ConfigResource
 import org.apache.kafka.common.errors._
-import org.apache.kafka.common.internals.Topic.{GROUP_METADATA_TOPIC_NAME, 
TRANSACTION_STATE_TOPIC_NAME, isInternal}
+import org.apache.kafka.common.internals.Topic.{GROUP_METADATA_TOPIC_NAME, 
TRANSACTION_STATE_TOPIC_NAME, SHARE_GROUP_STATE_TOPIC_NAME, isInternal}

Review Comment:
   A trivial point, but I would make the topic names in the import statement 
alphabetical.



##########
server/src/main/java/org/apache/kafka/server/config/ShareCoordinatorConfig.java:
##########
@@ -0,0 +1,158 @@
+/*
+ * 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.server.config;
+
+import org.apache.kafka.common.config.AbstractConfig;
+import org.apache.kafka.common.config.ConfigDef;
+import org.apache.kafka.common.record.CompressionType;
+import org.apache.kafka.common.utils.Utils;
+
+import java.util.Optional;
+
+import static org.apache.kafka.common.config.ConfigDef.Importance.HIGH;
+import static org.apache.kafka.common.config.ConfigDef.Importance.MEDIUM;
+import static org.apache.kafka.common.config.ConfigDef.Range.atLeast;
+import static org.apache.kafka.common.config.ConfigDef.Type.INT;
+import static org.apache.kafka.common.config.ConfigDef.Type.SHORT;
+
+public class ShareCoordinatorConfig {
+    public static final String STATE_TOPIC_NUM_PARTITIONS_CONFIG = 
"share.coordinator.state.topic.num.partitions";
+    public static final int STATE_TOPIC_NUM_PARTITIONS_DEFAULT = 50;
+    public static final String STATE_TOPIC_NUM_PARTITIONS_DOC = "The number of 
partitions for the share-group state topic (should not change after 
deployment).";
+
+    public static final String STATE_TOPIC_REPLICATION_FACTOR_CONFIG = 
"share.coordinator.state.topic.replication.factor";

Review Comment:
   As mentioned in the KIP, the values of 
`share.coordinator.state.topic.replication.factor=1` and 
`share.coordinator.state.topic.min.isr=1` should be included in the Internal 
Topic Settings section of the properties files in the directory `config/kraft`. 
I suggest you do that in this PR since the configs are being introduced now. 
This will make it a bit easier for people using a single-broker configuration 
taken directly from GitHub to try this out.



##########
core/src/test/scala/unit/kafka/server/AutoTopicCreationManagerTest.scala:
##########
@@ -38,7 +38,8 @@ import org.apache.kafka.common.security.auth.{KafkaPrincipal, 
KafkaPrincipalSerd
 import org.apache.kafka.common.utils.{SecurityUtils, Utils}
 import org.apache.kafka.coordinator.transaction.TransactionLogConfigs
 import org.apache.kafka.coordinator.group.{GroupCoordinator, 
GroupCoordinatorConfig}
-import org.apache.kafka.server.config.ServerConfigs
+import org.apache.kafka.coordinator.share.ShareCoordinator
+import org.apache.kafka.server.config.{ServerConfigs, ShareCoordinatorConfig}

Review Comment:
   I wonder whether `ShareCoordinatorConfig` should be in package 
`o.a.k.coordinator.share`.



##########
core/src/test/scala/unit/kafka/server/KafkaApisTest.scala:
##########
@@ -11507,6 +11510,230 @@ class KafkaApisTest extends Logging {
     assertEquals(Errors.NONE.code(), response.data.groups.get(1).errorCode())
   }
 
+  @Test
+  def testReadShareGroupStateSuccess(): Unit = {
+    val topicId = Uuid.randomUuid();
+    val readRequestData = new ReadShareGroupStateRequestData()
+      .setGroupId("group1")
+      .setTopics(List(
+        new ReadShareGroupStateRequestData.ReadStateData()
+          .setTopicId(topicId)
+          .setPartitions(List(
+            new ReadShareGroupStateRequestData.PartitionData()
+              .setPartition(1)
+              .setLeaderEpoch(1)
+          ).asJava)
+      ).asJava)
+
+    val readStateResultData: 
util.List[ReadShareGroupStateResponseData.ReadStateResult] = List(
+      new ReadShareGroupStateResponseData.ReadStateResult()
+        .setTopicId(topicId)
+        .setPartitions(List(
+          new ReadShareGroupStateResponseData.PartitionResult()
+            .setPartition(1)
+            .setErrorCode(Errors.NONE.code())
+            .setErrorMessage(null)
+            .setStateEpoch(1)
+            .setStartOffset(10)
+            .setStateBatches(List(
+              new ReadShareGroupStateResponseData.StateBatch()
+                .setFirstOffset(11)
+                .setLastOffset(15)
+                .setDeliveryState(0)
+                .setDeliveryCount(1)
+            ).asJava)
+        ).asJava)
+    ).asJava
+
+    val config = Map(
+      GroupCoordinatorConfig.NEW_GROUP_COORDINATOR_ENABLE_CONFIG -> "true",

Review Comment:
   I believe it is the case that the new group coordinator is enabled by 
default in trunk now. I expect this test no longer needs to enable it.



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