You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "AndrewJSchofield (via GitHub)" <gi...@apache.org> on 2024/06/13 20:26:48 UTC
[PR] KAFKA-16950: Define Persister interfaces and RPCs [kafka]
AndrewJSchofield opened a new pull request, #16335:
URL: https://github.com/apache/kafka/pull/16335
Define the interfaces and RPCs for share-group persistence. This PR is just RPCs and interfaces to allow building of the broker components which depend upon them. The implementation will follow in subsequent PRs.
### 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
Re: [PR] KAFKA-16950: Define Persister interfaces and RPCs [kafka]
Posted by "apoorvmittal10 (via GitHub)" <gi...@apache.org>.
apoorvmittal10 commented on code in PR #16335:
URL: https://github.com/apache/kafka/pull/16335#discussion_r1639739009
##########
server-common/src/main/java/org/apache/kafka/server/group/share/GroupTopicPartitionData.java:
##########
@@ -0,0 +1,87 @@
+/*
+ * 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.group.share;
+
+import java.util.List;
+import java.util.Objects;
+
+/**
+ * This class is used to contain the data for a group, a topic and its partitions in the interface to {@link Persister}.
+ *
+ * @param <P> The type of {@link PartitionInfoData}
+ */
+public class GroupTopicPartitionData<P extends PartitionInfoData> {
+ private final String groupId;
+ private final List<TopicData<P>> topicsData;
+
+ public GroupTopicPartitionData(String groupId, List<TopicData<P>> topicsData) {
+ this.groupId = groupId;
+ this.topicsData = topicsData;
+ }
+
+ public String groupId() {
+ return groupId;
+ }
+
+ public List<TopicData<P>> topicsData() {
+ return topicsData;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ GroupTopicPartitionData<?> that = (GroupTopicPartitionData<?>) o;
+ return Objects.equals(groupId, that.groupId) && Objects.equals(topicsData, that.topicsData);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(groupId, topicsData);
+ }
+
+ public static class Builder<P extends PartitionInfoData> {
+ private String groupId;
+ private List<TopicData<P>> topicsData;
+
+ public Builder<P> setGroupId(String groupId) {
+ this.groupId = groupId;
+ return this;
+ }
+
+ public Builder<P> setTopicsData(List<TopicData<P>> topicsData) {
+ this.topicsData = topicsData;
+ return this;
+ }
+
+ public Builder<P> setGroupTopicPartition(GroupTopicPartitionData<P> groupTopicPartitionData) {
+ this.groupId = groupTopicPartitionData.groupId();
+ this.topicsData = groupTopicPartitionData.topicsData();
+ return this;
+ }
+
+ public GroupTopicPartitionData<P> build() {
+ return new GroupTopicPartitionData<P>(this.groupId, this.topicsData);
+ }
+ }
+
+ @Override
+ public String toString() {
+ return "GroupTopicPartitionData(" + groupId + ", " + topicsData + ")";
Review Comment:
nit:
```suggestion
return "GroupTopicPartitionData {groupId=" + groupId + ", topicsData=" + topicsData + "}";
```
##########
server-common/src/main/java/org/apache/kafka/server/group/share/PartitionErrorData.java:
##########
@@ -0,0 +1,28 @@
+/*
+ * 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.group.share;
+
+/**
+ * This interface is implemented by classes used to contain the data for a partition with error data
+ * in the interface to {@link Persister}.
+ */
+public interface PartitionErrorData extends PartitionInfoData, PartitionIdData {
+ short errorCode();
Review Comment:
Do you think it would be good to have the javadocs for these interface methods as well?
##########
server-common/src/main/java/org/apache/kafka/server/group/share/ReadShareGroupStateParameters.java:
##########
@@ -0,0 +1,76 @@
+/*
+ * 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.group.share;
+
+import org.apache.kafka.common.message.ReadShareGroupStateRequestData;
+
+import java.util.stream.Collectors;
+
+/**
+ * This class contains the parameters for {@link Persister#readState(ReadShareGroupStateParameters)}.
+ */
+public class ReadShareGroupStateParameters implements PersisterParameters {
+
+ private final GroupTopicPartitionData<PartitionIdLeaderEpochData> groupTopicPartitionData;
+
+ private ReadShareGroupStateParameters(GroupTopicPartitionData<PartitionIdLeaderEpochData> groupTopicPartitionData) {
+ this.groupTopicPartitionData = groupTopicPartitionData;
+ }
+
+ public GroupTopicPartitionData<PartitionIdLeaderEpochData> groupTopicPartitionData() {
+ return groupTopicPartitionData;
+ }
+
+ public static ReadShareGroupStateParameters from(ReadShareGroupStateRequestData data) {
+// {
+// groupId,
+// topics[
+// topicId,
+// partitions [
+// partitionId
+// ]
+// ]
+// }
+ return new Builder()
+ .setGroupTopicPartitionData(new GroupTopicPartitionData<>(data.groupId(), data.topics().stream()
+ .map(readStateData -> new TopicData<>(readStateData.topicId(),
+ readStateData.partitions().stream()
+ .map(partitionData -> PartitionFactory.newPartitionIdLeaderEpochData(partitionData.partition(), partitionData.leaderEpoch()))
+ .collect(Collectors.toList())))
+ .collect(Collectors.toList())))
+ .build();
+ }
+
+ public static class Builder {
+ private GroupTopicPartitionData<PartitionIdLeaderEpochData> groupTopicPartitionData;
+
+ public Builder setGroupTopicPartitionData(GroupTopicPartitionData<PartitionIdLeaderEpochData> groupTopicPartitionData) {
+ this.groupTopicPartitionData = groupTopicPartitionData;
+ return this;
+ }
+
+ public ReadShareGroupStateParameters build() {
+ return new ReadShareGroupStateParameters(groupTopicPartitionData);
+ }
+ }
+
+ @Override
+ public String toString() {
+ return "ReadShareGroupStateParameters(" + groupTopicPartitionData + ")";
Review Comment:
Shall we define it as per other classes in the PR?
##########
server-common/src/main/java/org/apache/kafka/server/group/share/Persister.java:
##########
@@ -0,0 +1,76 @@
+/*
+ * 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.group.share;
+
+import org.apache.kafka.common.annotation.InterfaceStability;
+
+import java.util.concurrent.CompletableFuture;
+
+/**
+ * This interface introduces methods which can be used by callers to interact with the
+ * persistence implementation responsible for storing share group/partition states.
+ * For KIP-932, the default {@link Persister} use a share coordinator which stores information in
+ * an internal topic, but this interface allows for other variations as well.
+ */
+@InterfaceStability.Evolving
+public interface Persister {
+ /**
+ * Initialize the share partition state.
+ *
+ * @param request InitializeShareGroupStateParameters
+ * @return InitializeShareGroupStateResult
Review Comment:
Mayebe:
```suggestion
* @param request Request parameters for initializing the state of a share partition.
* @return A CompletableFuture that will be completed with the InitializeShareGroupStateResult result.
```
##########
server-common/src/main/java/org/apache/kafka/server/group/share/PartitionAllData.java:
##########
@@ -0,0 +1,36 @@
+/*
+ * 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.group.share;
+
+import java.util.List;
+
+/**
+ * This interface is implemented by classes used to contain the data for a partition with all of its data
+ * in the interface to {@link Persister}.
+ */
+public interface PartitionAllData extends PartitionInfoData, PartitionIdData {
+ int stateEpoch();
Review Comment:
nit: may be a line break.
##########
server-common/src/main/java/org/apache/kafka/server/group/share/PartitionAllData.java:
##########
@@ -0,0 +1,36 @@
+/*
+ * 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.group.share;
+
+import java.util.List;
+
+/**
+ * This interface is implemented by classes used to contain the data for a partition with all of its data
+ * in the interface to {@link Persister}.
+ */
+public interface PartitionAllData extends PartitionInfoData, PartitionIdData {
+ int stateEpoch();
Review Comment:
Also shall we have javadoc on the interface methods please?
##########
server-common/src/main/java/org/apache/kafka/server/group/share/Persister.java:
##########
@@ -0,0 +1,76 @@
+/*
+ * 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.group.share;
+
+import org.apache.kafka.common.annotation.InterfaceStability;
+
+import java.util.concurrent.CompletableFuture;
+
+/**
+ * This interface introduces methods which can be used by callers to interact with the
+ * persistence implementation responsible for storing share group/partition states.
+ * For KIP-932, the default {@link Persister} use a share coordinator which stores information in
+ * an internal topic, but this interface allows for other variations as well.
+ */
+@InterfaceStability.Evolving
+public interface Persister {
+ /**
+ * Initialize the share partition state.
+ *
+ * @param request InitializeShareGroupStateParameters
+ * @return InitializeShareGroupStateResult
+ */
+ CompletableFuture<InitializeShareGroupStateResult> initializeState(InitializeShareGroupStateParameters request) throws IllegalArgumentException;
+
+ /**
+ * Read share-partition state.
+ *
+ * @param request ReadShareGroupStateParameters
+ * @return ReadShareGroupStateResult
+ */
+ CompletableFuture<ReadShareGroupStateResult> readState(ReadShareGroupStateParameters request) throws IllegalArgumentException;
+
+ /**
+ * Write share-partition state.
+ *
+ * @param request WriteShareGroupStateParameters
+ * @return WriteShareGroupStateResult
+ */
+ CompletableFuture<WriteShareGroupStateResult> writeState(WriteShareGroupStateParameters request) throws IllegalArgumentException;
+
+ /**
+ * Delete share-partition state.
+ *
+ * @param request DeleteShareGroupStateParameters
+ * @return DeleteShareGroupStateResult
+ */
+ CompletableFuture<DeleteShareGroupStateResult> deleteState(DeleteShareGroupStateParameters request) throws IllegalArgumentException;
+
+ /**
+ * Read the offset information from share-partition state.
+ *
+ * @param request ReadShareGroupStateSummaryResult
+ * @return ReadShareGroupStateSummaryParameters
Review Comment:
```suggestion
* @return ReadShareGroupStateSummaryResult
```
##########
server-common/src/main/java/org/apache/kafka/server/group/share/Persister.java:
##########
@@ -0,0 +1,76 @@
+/*
+ * 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.group.share;
+
+import org.apache.kafka.common.annotation.InterfaceStability;
+
+import java.util.concurrent.CompletableFuture;
+
+/**
+ * This interface introduces methods which can be used by callers to interact with the
+ * persistence implementation responsible for storing share group/partition states.
+ * For KIP-932, the default {@link Persister} use a share coordinator which stores information in
+ * an internal topic, but this interface allows for other variations as well.
+ */
+@InterfaceStability.Evolving
+public interface Persister {
+ /**
+ * Initialize the share partition state.
+ *
+ * @param request InitializeShareGroupStateParameters
+ * @return InitializeShareGroupStateResult
+ */
+ CompletableFuture<InitializeShareGroupStateResult> initializeState(InitializeShareGroupStateParameters request) throws IllegalArgumentException;
+
+ /**
+ * Read share-partition state.
+ *
+ * @param request ReadShareGroupStateParameters
+ * @return ReadShareGroupStateResult
+ */
+ CompletableFuture<ReadShareGroupStateResult> readState(ReadShareGroupStateParameters request) throws IllegalArgumentException;
+
+ /**
+ * Write share-partition state.
+ *
+ * @param request WriteShareGroupStateParameters
+ * @return WriteShareGroupStateResult
+ */
+ CompletableFuture<WriteShareGroupStateResult> writeState(WriteShareGroupStateParameters request) throws IllegalArgumentException;
+
+ /**
+ * Delete share-partition state.
+ *
+ * @param request DeleteShareGroupStateParameters
+ * @return DeleteShareGroupStateResult
+ */
+ CompletableFuture<DeleteShareGroupStateResult> deleteState(DeleteShareGroupStateParameters request) throws IllegalArgumentException;
+
+ /**
+ * Read the offset information from share-partition state.
+ *
+ * @param request ReadShareGroupStateSummaryResult
Review Comment:
```suggestion
* @param request ReadShareGroupOffsetsStateParameters
```
##########
server-common/src/main/java/org/apache/kafka/server/group/share/ReadShareGroupStateParameters.java:
##########
@@ -0,0 +1,76 @@
+/*
+ * 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.group.share;
+
+import org.apache.kafka.common.message.ReadShareGroupStateRequestData;
+
+import java.util.stream.Collectors;
+
+/**
+ * This class contains the parameters for {@link Persister#readState(ReadShareGroupStateParameters)}.
+ */
+public class ReadShareGroupStateParameters implements PersisterParameters {
+
+ private final GroupTopicPartitionData<PartitionIdLeaderEpochData> groupTopicPartitionData;
+
+ private ReadShareGroupStateParameters(GroupTopicPartitionData<PartitionIdLeaderEpochData> groupTopicPartitionData) {
+ this.groupTopicPartitionData = groupTopicPartitionData;
+ }
+
+ public GroupTopicPartitionData<PartitionIdLeaderEpochData> groupTopicPartitionData() {
+ return groupTopicPartitionData;
+ }
+
+ public static ReadShareGroupStateParameters from(ReadShareGroupStateRequestData data) {
+// {
+// groupId,
+// topics[
+// topicId,
+// partitions [
+// partitionId
+// ]
+// ]
+// }
Review Comment:
Shall we remove 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
Re: [PR] KAFKA-16950: Define Persister interfaces and RPCs [kafka]
Posted by "AndrewJSchofield (via GitHub)" <gi...@apache.org>.
AndrewJSchofield commented on code in PR #16335:
URL: https://github.com/apache/kafka/pull/16335#discussion_r1639797544
##########
server-common/src/main/java/org/apache/kafka/server/group/share/ReadShareGroupStateParameters.java:
##########
@@ -0,0 +1,76 @@
+/*
+ * 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.group.share;
+
+import org.apache.kafka.common.message.ReadShareGroupStateRequestData;
+
+import java.util.stream.Collectors;
+
+/**
+ * This class contains the parameters for {@link Persister#readState(ReadShareGroupStateParameters)}.
+ */
+public class ReadShareGroupStateParameters implements PersisterParameters {
+
+ private final GroupTopicPartitionData<PartitionIdLeaderEpochData> groupTopicPartitionData;
+
+ private ReadShareGroupStateParameters(GroupTopicPartitionData<PartitionIdLeaderEpochData> groupTopicPartitionData) {
+ this.groupTopicPartitionData = groupTopicPartitionData;
+ }
+
+ public GroupTopicPartitionData<PartitionIdLeaderEpochData> groupTopicPartitionData() {
+ return groupTopicPartitionData;
+ }
+
+ public static ReadShareGroupStateParameters from(ReadShareGroupStateRequestData data) {
+// {
+// groupId,
+// topics[
+// topicId,
+// partitions [
+// partitionId
+// ]
+// ]
+// }
+ return new Builder()
+ .setGroupTopicPartitionData(new GroupTopicPartitionData<>(data.groupId(), data.topics().stream()
+ .map(readStateData -> new TopicData<>(readStateData.topicId(),
+ readStateData.partitions().stream()
+ .map(partitionData -> PartitionFactory.newPartitionIdLeaderEpochData(partitionData.partition(), partitionData.leaderEpoch()))
+ .collect(Collectors.toList())))
+ .collect(Collectors.toList())))
+ .build();
+ }
+
+ public static class Builder {
+ private GroupTopicPartitionData<PartitionIdLeaderEpochData> groupTopicPartitionData;
+
+ public Builder setGroupTopicPartitionData(GroupTopicPartitionData<PartitionIdLeaderEpochData> groupTopicPartitionData) {
+ this.groupTopicPartitionData = groupTopicPartitionData;
+ return this;
+ }
+
+ public ReadShareGroupStateParameters build() {
+ return new ReadShareGroupStateParameters(groupTopicPartitionData);
+ }
+ }
+
+ @Override
+ public String toString() {
+ return "ReadShareGroupStateParameters(" + groupTopicPartitionData + ")";
Review Comment:
Where there's a single piece of data within, I think just surrounding with parentheses is fine. In the other case where you identified that there are two pieces of data and there's no label, it's definitely worth adding the label.
--
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
Re: [PR] KAFKA-16950: Define Persister interfaces and RPCs [kafka]
Posted by "omkreddy (via GitHub)" <gi...@apache.org>.
omkreddy merged PR #16335:
URL: https://github.com/apache/kafka/pull/16335
--
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
Re: [PR] KAFKA-16950: Define Persister interfaces and RPCs [kafka]
Posted by "AndrewJSchofield (via GitHub)" <gi...@apache.org>.
AndrewJSchofield commented on PR #16335:
URL: https://github.com/apache/kafka/pull/16335#issuecomment-2168022748
@apoorvmittal10 Thanks for the review.
--
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
Re: [PR] KAFKA-16950: Define Persister interfaces and RPCs [kafka]
Posted by "AndrewJSchofield (via GitHub)" <gi...@apache.org>.
AndrewJSchofield commented on code in PR #16335:
URL: https://github.com/apache/kafka/pull/16335#discussion_r1639795031
##########
server-common/src/main/java/org/apache/kafka/server/group/share/PartitionAllData.java:
##########
@@ -0,0 +1,36 @@
+/*
+ * 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.group.share;
+
+import java.util.List;
+
+/**
+ * This interface is implemented by classes used to contain the data for a partition with all of its data
+ * in the interface to {@link Persister}.
+ */
+public interface PartitionAllData extends PartitionInfoData, PartitionIdData {
+ int stateEpoch();
Review Comment:
I think it would be excessive. They're just getters and it's pretty clear.
--
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
Re: [PR] KAFKA-16950: Define Persister interfaces and RPCs [kafka]
Posted by "AndrewJSchofield (via GitHub)" <gi...@apache.org>.
AndrewJSchofield commented on code in PR #16335:
URL: https://github.com/apache/kafka/pull/16335#discussion_r1639801028
##########
server-common/src/main/java/org/apache/kafka/server/group/share/Persister.java:
##########
@@ -0,0 +1,76 @@
+/*
+ * 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.group.share;
+
+import org.apache.kafka.common.annotation.InterfaceStability;
+
+import java.util.concurrent.CompletableFuture;
+
+/**
+ * This interface introduces methods which can be used by callers to interact with the
+ * persistence implementation responsible for storing share group/partition states.
+ * For KIP-932, the default {@link Persister} use a share coordinator which stores information in
+ * an internal topic, but this interface allows for other variations as well.
+ */
+@InterfaceStability.Evolving
+public interface Persister {
+ /**
+ * Initialize the share partition state.
+ *
+ * @param request InitializeShareGroupStateParameters
+ * @return InitializeShareGroupStateResult
+ */
+ CompletableFuture<InitializeShareGroupStateResult> initializeState(InitializeShareGroupStateParameters request) throws IllegalArgumentException;
+
+ /**
+ * Read share-partition state.
+ *
+ * @param request ReadShareGroupStateParameters
+ * @return ReadShareGroupStateResult
+ */
+ CompletableFuture<ReadShareGroupStateResult> readState(ReadShareGroupStateParameters request) throws IllegalArgumentException;
+
+ /**
+ * Write share-partition state.
+ *
+ * @param request WriteShareGroupStateParameters
+ * @return WriteShareGroupStateResult
+ */
+ CompletableFuture<WriteShareGroupStateResult> writeState(WriteShareGroupStateParameters request) throws IllegalArgumentException;
+
+ /**
+ * Delete share-partition state.
+ *
+ * @param request DeleteShareGroupStateParameters
+ * @return DeleteShareGroupStateResult
+ */
+ CompletableFuture<DeleteShareGroupStateResult> deleteState(DeleteShareGroupStateParameters request) throws IllegalArgumentException;
+
+ /**
+ * Read the offset information from share-partition state.
+ *
+ * @param request ReadShareGroupStateSummaryResult
+ * @return ReadShareGroupStateSummaryParameters
Review Comment:
Good catch. Thank you :)
--
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