ableegoldman commented on a change in pull request #8892:
URL: https://github.com/apache/kafka/pull/8892#discussion_r492382332



##########
File path: 
streams/src/test/java/org/apache/kafka/streams/processor/internals/assignment/AssignmentTestUtils.java
##########
@@ -77,13 +86,8 @@
     public static final TaskId TASK_2_3 = new TaskId(2, 3);
 
     public static final Set<TaskId> EMPTY_TASKS = emptySet();
-    public static final List<TaskId> EMPTY_TASK_LIST = emptyList();
-    public static final Map<TaskId, Long> EMPTY_TASK_OFFSET_SUMS = emptyMap();
     public static final Map<TopicPartition, Long> EMPTY_CHANGELOG_END_OFFSETS 
= new HashMap<>();
 
-    private AssignmentTestUtils() {}

Review comment:
       > Do we need to instantiate this class now
   
   No...isn't that exactly the reason we don't need this?

##########
File path: 
streams/src/main/java/org/apache/kafka/streams/processor/internals/assignment/ClientState.java
##########
@@ -288,17 +288,17 @@ public void computeTaskLags(final UUID uuid, final 
Map<TaskId, Long> allTaskEndO
             final Long endOffsetSum = taskEntry.getValue();
             final Long offsetSum = taskOffsetSums.getOrDefault(task, 0L);
 
-            if (endOffsetSum < offsetSum) {
+            if (offsetSum == Task.LATEST_OFFSET) {
+                taskLagTotals.put(task, Task.LATEST_OFFSET);
+            } else if (offsetSum == UNKNOWN_OFFSET_SUM) {
+                taskLagTotals.put(task, UNKNOWN_OFFSET_SUM);
+            } else if (endOffsetSum < offsetSum) {

Review comment:
       I don't know about fixing this before, but I found this while debugging 
these tests and fixed it on the side in this PR. To be fair, it wasn't hurting 
anything since we happen to put the right thing in the `taskLagTotals` map, but 
the warning logged was definitely incorrect.

##########
File path: 
streams/src/test/java/org/apache/kafka/streams/processor/internals/assignment/AssignmentTestUtils.java
##########
@@ -77,13 +86,8 @@
     public static final TaskId TASK_2_3 = new TaskId(2, 3);
 
     public static final Set<TaskId> EMPTY_TASKS = emptySet();
-    public static final List<TaskId> EMPTY_TASK_LIST = emptyList();
-    public static final Map<TaskId, Long> EMPTY_TASK_OFFSET_SUMS = emptyMap();
     public static final Map<TopicPartition, Long> EMPTY_CHANGELOG_END_OFFSETS 
= new HashMap<>();
 
-    private AssignmentTestUtils() {}

Review comment:
       Ah yeah ok. I'll put it back




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

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to