zhaohaidao commented on code in PR #14271:
URL: https://github.com/apache/kafka/pull/14271#discussion_r1324884926


##########
group-coordinator/src/test/java/org/apache/kafka/coordinator/group/GroupMetadataManagerTest.java:
##########
@@ -431,14 +434,17 @@ public void rollback() {
             snapshotRegistry.revertToSnapshot(lastCommittedOffset);
         }
 
+        public void getOrCreateSnapshot() {
+            snapshotRegistry.getOrCreateSnapshot(lastCommittedOffset);
+        }

Review Comment:
   This will cause testListGroups to fail because 
groupMetadataManager.listGroups always uses lastCommittedOffset to query. 
Putting getOrCreateSnapshot(lastWrittenOffset) at the beginning of the replay 
function will lead to the following result: the largest epoch in the snapshot 
is always 1 less than lastCommittedOffset. In this way, listGroups cannot find 
the expected results.
   Putting getOrCreateSnapshot(lastWrittenOffset) at the end of the function, 
especially after lastWrittenOffset+1, all cases can pass, which is consistent 
with the semantics of CoordinatorRuntime, that is, always update the memory 
first, then update lastWrittenOffset, and use the latest lastWrittenOffset to 
update snapshot.
   WDYT?



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