mjsax commented on code in PR #22788:
URL: https://github.com/apache/kafka/pull/22788#discussion_r3575299032


##########
group-coordinator/group-coordinator-api/src/main/java/org/apache/kafka/coordinator/group/api/assignor/streams/TaskId.java:
##########
@@ -25,6 +28,8 @@
  * @param subtopologyId The unique identifier of the subtopology.
  * @param partition     The partition of the input topics this task is 
processing.
  */
[email protected]
[email protected]
 public record TaskId(String subtopologyId, int partition) implements 
Comparable<TaskId> {

Review Comment:
   It seems KIP-1357 forget to include this one? Should also become an 
interface for this case, right?



##########
group-coordinator/group-coordinator-api/src/main/java/org/apache/kafka/coordinator/group/api/assignor/streams/MemberAssignmentState.java:
##########
@@ -0,0 +1,62 @@
+/*
+ * 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.api.assignor.streams;
+
+import org.apache.kafka.common.annotation.InterfaceAudience;
+import org.apache.kafka.common.annotation.InterfaceStability;
+
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Interface representing the current assignment state for a streams group 
member.
+ *
+ * <p>This is the assignment the member currently owns and is used by the 
{@link TaskAssignor}
+ * to compute a new, sticky target assignment. Note that the assignor does not 
assign warm-up
+ * tasks itself (they are decided during reconciliation), but the 
currently-assigned warm-up
+ * tasks are exposed here so that the assignor can take them into account.
+ */
[email protected]
[email protected]
+public interface MemberAssignmentState {
+
+    /**
+     * @return The current active tasks keyed by subtopology Id.
+     */
+    Map<String, Set<Integer>> activeTasks();
+
+    /**
+     * @return The current standby tasks keyed by subtopology Id.
+     */
+    Map<String, Set<Integer>> standbyTasks();
+
+    /**
+     * @return The current warm-up tasks keyed by subtopology Id.
+     */
+    Map<String, Set<Integer>> warmupTasks();
+
+    /**
+     * @return The last received cumulative task offsets of assigned tasks or 
dormant tasks.
+     */
+    Map<TaskId, Long> taskOffsets();

Review Comment:
   One argument during KIP discussion was, to return data based on wire format. 
That's why we don't have `Set<TaskId> activeTasks()` but `Map<String, 
Set<Integer>> activeTasks()`.
   
   And I just realize that the wire-format between both task-ids (which is an 
array of `[]TaskId` and each TaskId is `String,[]int32` format) and 
task-offsets (which is an array of `[]TaskOffset` and each TaskOffset is 
`string,int32,int64`) have a different format...
   
   But I am now wondering what the best representation for `string,int32,int64` 
triple would be -- while `Map<TaskId, Long>` (with `TaskId` == `String + int`) 
is not a bad fit, it's somewhat a mismatch to what we do for `activeTasks()` 
above... 🤔 



##########
group-coordinator/group-coordinator-api/src/main/java/org/apache/kafka/coordinator/group/api/assignor/streams/GroupAssignment.java:
##########
@@ -24,6 +27,8 @@
  *
  * @param members The member assignments keyed by member ID.
  */
[email protected]
[email protected]
 public record GroupAssignment(Map<String, MemberAssignment> members) {

Review Comment:
   The KIP defines this as a class, not a record. -- Given that this is an 
_output/return_ type, not an input to the assignor, it might actually be ok to 
keep as record, and we could also update the KIP?
   
   \cc @lianetm for input



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