mjsax commented on code in PR #23969:
URL: https://github.com/apache/kafka/pull/23969#discussion_r4594300295
##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/streams/AssignmentRefinerImpl.java:
##########
@@ -117,10 +119,15 @@ static CurrentAssignmentIndex indexCurrentAssignment(
final Map<TaskId, List<TaskCopy>> taskCopies = new HashMap<>();
final Map<String, Set<TaskId>> reportedByProcess = new HashMap<>();
final Map<String, Set<TaskId>> heldByProcess = new HashMap<>();
+ final Map<String, Integer> memberCounts = new HashMap<>();
+ final Map<String, Integer> statefulTaskCounts = new HashMap<>();
for (final StreamsGroupMember member : members.values()) {
final MemberTaskOffsets offsets =
taskOffsets.getOrDefault(member.memberId(), MemberTaskOffsets.EMPTY);
final Set<TaskId> heldOnProcess =
heldByProcess.computeIfAbsent(member.processId(), __ -> new HashSet<>());
+ // Counted rather than read off heldOnProcess, so that the load
does not depend on the invariant that
+ // a process never holds two copies of one task.
+ final int[] statefulTaskCount = new int[1];
Review Comment:
I seems you only use a array to get some "container" that you can pass into
the lambda? -- This' not really obvious -- wondering if we should add a
comment, or have some small helper class
```
private static final class Counter {
private int count;
}
```
instead, which might make it more 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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]