lucasbru commented on code in PR #24256:
URL: https://github.com/apache/kafka/pull/24256#discussion_r4642580665


##########
streams/src/main/java/org/apache/kafka/streams/processor/internals/StoreChangelogReader.java:
##########
@@ -866,11 +870,7 @@ private Set<Task> getTasksFromPartitions(final Map<TaskId, 
Task> tasks,
     }
 
     private void clearTaskTimeout(final Set<Task> tasks) {
-        tasks.forEach(t -> {
-            if (t != null) {
-                t.clearTaskTimeout();
-            }
-        });
+        tasks.forEach(Task::clearTaskTimeout);
     }

Review Comment:
   Callers only pass partitions of tasks that are given to restore() (paused 
ones are filtered out before the lookups), so the set never contains null. A 
null here would be a bug in the caller, and we want it to fail fast rather than 
be skipped.



##########
streams/src/test/java/org/apache/kafka/streams/processor/internals/StoreChangelogReaderTest.java:
##########
@@ -1260,6 +1261,70 @@ public void 
logicalChangelogEndOffsetsShouldReturnNullWhenBothSourcesUnknown() {
         assertNull(changelogReader.logicalChangelogEndOffsets().get(tp));
     }
 
+    @Test
+    public void shouldNotLookUpLimitOffsetsForChangelogsOfPausedStandbyTasks() 
{
+        setupStandbyStateManager();
+        setupStoreMetadata();
+        setupStore();
+        final TaskId taskId = new TaskId(0, 0);
+        when(standbyStateManager.taskId()).thenReturn(taskId);
+        when(standbyStateManager.changelogAsSource(tp)).thenReturn(true);
+        when(storeMetadata.offset()).thenReturn(3L);
+
+        final AtomicBoolean failLookups = new AtomicBoolean(false);
+        final AtomicInteger lookups = new AtomicInteger();
+        final MockAdminClient adminClient = new MockAdminClient() {
+            @Override
+            public synchronized ListConsumerGroupOffsetsResult 
listConsumerGroupOffsets(final Map<String, ListConsumerGroupOffsetsSpec> 
groupSpecs, final ListConsumerGroupOffsetsOptions options) {
+                lookups.incrementAndGet();

Review Comment:
   The only caller passes a single group, and committedOffsetForChangelogs 
returns early on an empty partition set, so the map is never empty. Leaving it 
as is.



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