dajac commented on code in PR #15155:
URL: https://github.com/apache/kafka/pull/15155#discussion_r1448472421


##########
group-coordinator/src/test/java/org/apache/kafka/coordinator/group/OffsetMetadataManagerTest.java:
##########
@@ -1963,6 +2080,75 @@ public void 
testFetchAllOffsetsAtDifferentCommittedOffset() {
         ), context.fetchAllOffsets("group", Long.MAX_VALUE));
     }
 
+    @Test
+    public void testFetchAllOffsetsWithPendingTransactionalOffsets() {
+        OffsetMetadataManagerTestContext context = new 
OffsetMetadataManagerTestContext.Builder().build();
+
+        context.groupMetadataManager.getOrMaybeCreateConsumerGroup("group", 
true);
+
+        context.commitOffset("group", "foo", 0, 100L, 1);
+        context.commitOffset("group", "foo", 1, 110L, 1);
+        context.commitOffset("group", "bar", 0, 200L, 1);
+
+        context.commit();
+
+        assertEquals(3, context.lastWrittenOffset);
+        assertEquals(3, context.lastCommittedOffset);
+
+        context.commitOffset(10L, "group", "foo", 1, 111L, 1, 
context.time.milliseconds());
+        context.commitOffset(10L, "group", "bar", 0, 201L, 1, 
context.time.milliseconds());

Review Comment:
   very good question. i wondered the same. when all offsets are requested, the 
list of partitions is built from the main offset storage `offsets`. so if a 
partition has a pending transaction but has no previous offset, we don't return 
it at all. i am not sure if it was really done on purpose or not but it is how 
the current scala implementation works. i considered also returning the pending 
partitions but i eventually decided to follow the current implementation for 
now. we could revise this later on if we want to.



-- 
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-unsubscr...@kafka.apache.org

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

Reply via email to